Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Getting the waste date and type for the Netherlands

Project Description

This library is meant to interface with mijnafvalwijzer.

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

pip install afvalwijzer

Uninstallation

pip uninstall afvalwijzer

Usage

>>> 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')

>>> garbage.pickupdates
['dinsdag 02 januari', 'dinsdag 02 januari']

>>> garbage.wastetypes
['Groente-, Fruit- en Tuinafval', 'Kerstbomen']

The following function only returns true if the pickup date is the same as today.

>>> garbage.notify
True

Below is shown how I use it to get notified using pushbullet.

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.

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.

Release History

0.2.7 (2018-01-01)

  • Verification added for zipcode value
  • Test added for assert on the raise

0.2.6 (2017-12-31)

  • Change the dates in ‘HISTORY.rst’ to the correct month
  • Library also returns a list for multiple dates highlighted on the webpage

0.2.5 (2017-12-28)

0.2.4 (2017-12-27)

  • Fixed rst issues; now showing correct html on pypi
  • learned about python setup.py checkdocs; require pygments and collective.checkdocs

0.2.1 (2017-12-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-12-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

Release History

Release History

This version
History Node

0.2.7

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
afvalwijzer-0.2.7-py2.py3-none-any.whl (7.4 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jan 1, 2018
afvalwijzer-0.2.7.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Jan 1, 2018

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting