Skip to main content

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

afvaldienst-1.1.2.tar.gz (8.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page