Getting information on trash for the Netherlands for mijnafvalwijzer.nl and afvalstoffendienstkalender.nl
Project description
Afvaldienst library
This library is meant to interface with mijnafvalwijzer.nl and/or afvalstoffendienstkalender.nl It is meant to use with home automation projects like Home Assistant.
Installation
.. code:: bash
pip install afvaldienst
Uninstallation
.. code:: bash
pip uninstall afvaldienst
Usage
.. code:: python
>>> from Afvaldienst import Afvaldienst
>>> provider = 'mijnafvalwijzer'
>>> api_token = ''
>>> zipcode = '1111AA'
>>> housenumber = '1'
>>> suffix = ''
>>> start_date = 'True or False' (start counting wihth Today's date or with Tomorrow's date)
>>> trash = Afvaldienst(provider, api_token, zipcode, housenumber, suffix)
>>> trash.trash_json
[{'nameType': 'gft', 'type': 'gft', 'date': '2019-12-20'}, {'nameType': 'pmd', 'type': 'pmd', 'date': '2019-12-28'}]
>>> trash.trash_schedule
[{'key': 'pmd', 'value': '31-10-2019', 'days_remaining': 8}, {'key': 'restafval', 'value': '15-11-2019', 'days_remaining': 23}, {'key': 'papier', 'value': '20-11-2019', 'days_remaining': 28}]
>>> trash.trash_schedule_custom
[{'key': 'first_next_in_days', 'value': 8}, {'key': 'today', 'value': 'None'}, {'key': 'tomorrow', 'value': 'None'},
>>> trash.trash_types
['gft', 'kerstbomen', 'pmd', 'restafval', 'papier']
Or use the scraper:
>>>from AfvaldienstScraper import AfvaldienstScraper
>>> provider = 'mijnafvalwijzer'
>>> zipcode = '1111AA'
>>> housenumber = '1'
>>> start_date = 'True or False' (start counting wihth Today's date or with Tomorrow's date)
>>> trash = AfvaldienstScraper(provider, zipcode, housenumber)
>>> trash.trash_schedule
[{'key': 'pmd', 'value': '31-10-2019', 'days_remaining': 8}, {'key': 'restafval', 'value': '15-11-2019', 'days_remaining': 23}, {'key': 'papier', 'value': '20-11-2019', 'days_remaining': 28}]
>>> trash.trash_schedule_custom
[{'key': 'first_next_in_days', 'value': 8}, {'key': 'today', 'value': 'None'}, {'key': 'tomorrow', 'value': 'None'},
>>> trash.trash_types
['gft', 'kerstbomen', 'pmd', 'textiel', 'restafval', 'papier']
>>>> trash.trash_types_from_schedule
['gft', 'papier', 'pmd', 'restafval', 'textiel', 'kerstbomen', 'today', 'tomorrow', 'day_after_tomorrow', 'first_next_in_days', 'first_next_item', 'first_next_date']
Contributors are most welcome
- I'm still learning how to code properly.
.. :changelog:
Release History
1.0.6 (2020-09-21) ++++++++++++++++ New release
- Remove unnecessary data
1.0.6 (2020-09-21) ++++++++++++++++ New release
- Add scraper funcionality
1.0.5 (2020-09-21) ++++++++++++++++ Bugfix release
- Multiple minor bugs regarding the new api from mijnafvalwijzer
1.0.4 (2020-09-16) ++++++++++++++++ Bugfix release
- Add trash None value on no data
1.0.3 (2020-09-16) ++++++++++++++++ Bugfix release
- add trash_schedule and trash_schedule_custom trash type list overview
1.0.2 (2020-09-16) ++++++++++++++++ Bugfix release
- add trash_schedule and trash_schedule_custom trash type list overview
1.0.1 (2020-09-16) ++++++++++++++++ Bugfix release
- remove api tokens (as requested by the provider(s))
1.0.0 (2020-09-15) ++++++++++++++++ Bugfix release
- complete rewrite of the logic for parsing json data
0.8.0 (2020-09-13) ++++++++++++++++ Bugfix release
- moved from json..nl to api..nl
- added additional error handling
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file afvaldienst-1.1.4.tar.gz
.
File metadata
- Download URL: afvaldienst-1.1.4.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45a0279444b1891e01cddfd4f9f103d1e5dad82d5a26edde10eec24ca175f544 |
|
MD5 | 707092ce55c44e5b9563e82e547afdb1 |
|
BLAKE2b-256 | 39922fbcf0d69c2ecca7081fa0e9ce1e83578eafd37e1e525a3c494b59ae0574 |