Skip to main content

Afvalwijzer library

PyPi Status Build Status Coverage Status Wheel Status Python versions

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

Metadata

Release files for afvalwijzer 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for afvalwijzer 0.2.7
File Size Uploaded Provenance Actions
afvalwijzer-0.2.7.tar.gz 5.5 kB Without provenance Details for afvalwijzer-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for afvalwijzer 0.2.7
File Interpreter ABI Platform Actions
afvalwijzer-0.2.7-py2.py3-none-any.whl Python 3, Python 2 none any Details for afvalwijzer-0.2.7-py2.py3-none-any.whl

Total release size: 12.9 kB

Release files / afvalwijzer-0.2.7.tar.gz

Download URL afvalwijzer-0.2.7.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a57a5cd86a4935f0a8811da4313095847031b7b786827fa9d92057e8b8084e31
BLAKE2b-256 checksum
How to use checksums
593ae5211e39dca8fcd912d6d920f1fa531186efa09d67f2e12817fa5f424cc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / afvalwijzer-0.2.7-py2.py3-none-any.whl

Download URL afvalwijzer-0.2.7-py2.py3-none-any.whl
Size 7.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6c9c7f99d93eeb1bf44023c9a1f0d1c18b05abd72dca2ded409f85c088cf7d59
BLAKE2b-256 checksum
How to use checksums
12d4c9cdeb7954e52538723252e29b5614ae090e085de631942c1c7eb975bbe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for afvalwijzer 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page