Skip to main content

A package to gather waste collection details for UK addresses served by Cardiff Council.

Project description

cardiffwaste

About

This is a simple package to collect upcoming waste collections for an addresses served by Cardiff Council.

Installation

pip install cardiffwaste

Usage

Getting Collections

Getting collections requires your Unique Property Reference Number (UPRN), the example below uses 123456789012. If you don't know this (highly likely), you can use the address_search helper to look up the UPRN as decribed below

from cardiffwaste import WasteCollections

address = WasteCollections(123456789012)
collections = address.get_next_collections()

print(collections["general"]["collection_date"])
# 2022-01-15

Five collection types are currently handled, which are general, recycling, food, garden and hygiene. These keys will only be present if a collection is scheduled in the next 4 weeks. For scheduled collections, each collection will have the following keys:

Attribute Value Type Description
type str The collection type (general, recycling, food, or garden)
collection_date datetime.date Date of next collection
collection_type str scheduled or rescheduled depending on if planned has been missed
image str URL of a representation of the collection type

Address Search

You can find your UPRN using the address_search helper. This takes any reasonable string describing the address, such as a post code, and returns a dictionary of possible matches. The returned dictionary is of the form {int(UPRN): str(address_description)}

The helper can be called as follows:

from cardiffwaste import address_search

address_search("CF10 1AA")

# returns: 
# {10090717081: 'Flat 1, 22 St Mary Street, Cathays, Cardiff, CF10 1AA',
#  10090717082: 'Flat 2, 22 St Mary Street, Cathays, Cardiff, CF10 1AA',
#  10090717083: 'Flat 3, 22 St Mary Street, Cathays, Cardiff, CF10 1AA',
#  10090717084: 'Flat 4, 22 St Mary Street, Cathays, Cardiff, CF10 1AA',
#  10095459274: 'Managers Flat, Cardiff Cottage, 25 St Mary Street, Cathays,  Cardiff, CF10 1AA'}

address_search("mansion house")
# returns:
# {10003566863: 'First Floor Flat, Mansion House, Richmond Road, Roath, Cardiff, CF24 3UN',
#  10003566864: 'First Floor Rear, Mansion House, Richmond Road, Roath, Cardiff, CF24 3UN',
#  10003566865: 'Second Floor, Mansion House, Richmond Road, Roath, Cardiff, CF24 3UN',
#  200002933742: 'Mansion Shand House, 20 Newport Road, Adamsdown, Cardiff, CF24 0DB'}

Contributing

My current plans are to get this to what might actually be called a stable state and sort out CI.

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

cardiffwaste-0.2.6.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cardiffwaste-0.2.6-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file cardiffwaste-0.2.6.tar.gz.

File metadata

  • Download URL: cardiffwaste-0.2.6.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cardiffwaste-0.2.6.tar.gz
Algorithm Hash digest
SHA256 a0931d1e119052172cf3027917f9afad5d858d111be17d23a834a7c07e25f525
MD5 c1602ba28ca0d231cc7b222626d4d7e7
BLAKE2b-256 d9ea62f0c3afdbbf875914c853f35f05ab6be329edf6151cb31670f854883d63

See more details on using hashes here.

File details

Details for the file cardiffwaste-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: cardiffwaste-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cardiffwaste-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2768a1eb55859826f8f6b2b2932ca211a1133c1b1fb508b62b69aa901313c716
MD5 983a5c4ca583de4b2d05d01f087fdad8
BLAKE2b-256 d2ef0aa50186ac5fea42d53c0372c86619fb8903d1112e369f38f12c66935bff

See more details on using hashes here.

Supported by

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