Getting the waste date and type for the Netherlands
Project description
Afvalwijzer library
===================
|PyPi Status| |Build Status| |Coverage Status| |Wheel| |Python versions|
This library is meant to interface with http://www.mijnafvalwijzer.nl/
It is meant as a *workaround* for the afvalwijzer app (used in the Netherlands) to be notified when to place the bin at the road.
Since this app delivers a poor functionality for notifications, and I needed a small project, I created this.
Installation
------------
.. code:: bash
pip install afvalwijzer
Uninstallation
--------------
.. code:: bash
pip uninstall afvalwijzer
Usage
-----
.. code:: python
>>> from Afvalwijzer import Afvalwijzer
>>> zipcode = '3564KV'
>>> number = '13'
>>> garbage = Afvalwijzer(zipcode, number)
>>> garbage.pickupdate
'Vandaag'
>>> garbage.wastetype
'Groente-, Fruit- en Tuinafval'
>>> garbage.garbage
('Vandaag', 'Groente-, Fruit- en Tuinafval')
The following function only returns true if the pickup date is the same as today.
.. code:: python
>>> garbage.notify
True
Below is shown how I use it to get notified using pushbullet.
.. code:: python
#!/usr/bin/env python3
from Afvalwijzer import Afvalwijzer
from pushbullet import Pushbullet
def notification(device=None):
pb = Pushbullet(pushbulletapi)
try:
mydevice = pb.get_device(device)
except:
mydevice = None
push = pb.push_note(
"Container: {}".format(wastetype),
"Container: {}\nDate: {}".format(wastetype, pickupdate),
device=mydevice)
zipcode = '3564KV'
number = 13
pushbulletapi = 'pushbullet_api_key'
pushbulletdevice = 'LGE Nexus 5X'
garbage = Afvalwijzer(zipcode, number)
pickupdate, wastetype = garbage.garbage
notify = garbage.notify
if notify and pushbulletapi:
notification(pushbulletdevice)
Cron job
--------
This script can now be set up as a cronjob on your server or alike.
.. code:: bash
0 6 * * * cd /path/to/script/notify_garbage.py > /dev/null 2>&1
Caveat
------
* Output is provided in Dutch due to the main website. There is a button for English, but I haven't got it working (yet).
Contributors are most welcome
-----------------------------
I'm still learning how to work with it all. Therefore feedback, advice, pull request etc. are most welcome.
.. |PyPi Status| image:: https://img.shields.io/pypi/v/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. |Build Status| image:: https://travis-ci.org/bambam82/afvalwijzer.svg?branch=master
:target: https://travis-ci.org/bambam82/afvalwijzer
.. |Coverage Status| image:: https://coveralls.io/repos/github/bambam82/afvalwijzer/badge.svg?branch=master
:target: https://coveralls.io/github/bambam82/afvalwijzer?branch=master
.. |Wheel| image:: https://img.shields.io/pypi/wheel/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. |Python versions| image:: https://img.shields.io/pypi/pyversions/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. :changelog:
Release History
---------------
0.2.1 (2017-08-26)
++++++++++++++++++
- Changing the way of working with '__version__'
- Changed versioning scheme
- Removed the datetime dependency
- Rewritten parts and tests to work with python 2.7 and 3.4+
- Rewritten Markdown to restructured text
0.2 (2017-08-25)
++++++++++++++++
- Status Beta
- Versioning in sync, setup reads it from the program
- History (this file) added
- Property decorators instead of traditional getters
- README improved
0.1 (2017-08-24)
++++++++++++++++
**Initial release**
- first working release
- py.tests
- travis-ci
- pypi
- hours of troubleshooting the 2 above
===================
|PyPi Status| |Build Status| |Coverage Status| |Wheel| |Python versions|
This library is meant to interface with http://www.mijnafvalwijzer.nl/
It is meant as a *workaround* for the afvalwijzer app (used in the Netherlands) to be notified when to place the bin at the road.
Since this app delivers a poor functionality for notifications, and I needed a small project, I created this.
Installation
------------
.. code:: bash
pip install afvalwijzer
Uninstallation
--------------
.. code:: bash
pip uninstall afvalwijzer
Usage
-----
.. code:: python
>>> from Afvalwijzer import Afvalwijzer
>>> zipcode = '3564KV'
>>> number = '13'
>>> garbage = Afvalwijzer(zipcode, number)
>>> garbage.pickupdate
'Vandaag'
>>> garbage.wastetype
'Groente-, Fruit- en Tuinafval'
>>> garbage.garbage
('Vandaag', 'Groente-, Fruit- en Tuinafval')
The following function only returns true if the pickup date is the same as today.
.. code:: python
>>> garbage.notify
True
Below is shown how I use it to get notified using pushbullet.
.. code:: python
#!/usr/bin/env python3
from Afvalwijzer import Afvalwijzer
from pushbullet import Pushbullet
def notification(device=None):
pb = Pushbullet(pushbulletapi)
try:
mydevice = pb.get_device(device)
except:
mydevice = None
push = pb.push_note(
"Container: {}".format(wastetype),
"Container: {}\nDate: {}".format(wastetype, pickupdate),
device=mydevice)
zipcode = '3564KV'
number = 13
pushbulletapi = 'pushbullet_api_key'
pushbulletdevice = 'LGE Nexus 5X'
garbage = Afvalwijzer(zipcode, number)
pickupdate, wastetype = garbage.garbage
notify = garbage.notify
if notify and pushbulletapi:
notification(pushbulletdevice)
Cron job
--------
This script can now be set up as a cronjob on your server or alike.
.. code:: bash
0 6 * * * cd /path/to/script/notify_garbage.py > /dev/null 2>&1
Caveat
------
* Output is provided in Dutch due to the main website. There is a button for English, but I haven't got it working (yet).
Contributors are most welcome
-----------------------------
I'm still learning how to work with it all. Therefore feedback, advice, pull request etc. are most welcome.
.. |PyPi Status| image:: https://img.shields.io/pypi/v/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. |Build Status| image:: https://travis-ci.org/bambam82/afvalwijzer.svg?branch=master
:target: https://travis-ci.org/bambam82/afvalwijzer
.. |Coverage Status| image:: https://coveralls.io/repos/github/bambam82/afvalwijzer/badge.svg?branch=master
:target: https://coveralls.io/github/bambam82/afvalwijzer?branch=master
.. |Wheel| image:: https://img.shields.io/pypi/wheel/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. |Python versions| image:: https://img.shields.io/pypi/pyversions/afvalwijzer.svg
:target: https://pypi.python.org/pypi/afvalwijzer
.. :changelog:
Release History
---------------
0.2.1 (2017-08-26)
++++++++++++++++++
- Changing the way of working with '__version__'
- Changed versioning scheme
- Removed the datetime dependency
- Rewritten parts and tests to work with python 2.7 and 3.4+
- Rewritten Markdown to restructured text
0.2 (2017-08-25)
++++++++++++++++
- Status Beta
- Versioning in sync, setup reads it from the program
- History (this file) added
- Property decorators instead of traditional getters
- README improved
0.1 (2017-08-24)
++++++++++++++++
**Initial release**
- first working release
- py.tests
- travis-ci
- pypi
- hours of troubleshooting the 2 above
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
afvalwijzer-0.2.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for afvalwijzer-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42a3fd58dcde4ce49f7afb86f9cc8a2923d82ab86fb6187cd6b1a058e93e8ee7 |
|
MD5 | 705f24ea3afdf426d64a87eb599d0450 |
|
BLAKE2b-256 | 4a4a394782d0dd759088a19b827f006cb22806ad36a2f29636beca582225c3d8 |