Skip to main content

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.

Metadata

Release files for cardiffwaste 0.2.6

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

Source distribution (sdist)

Source distribution for cardiffwaste 0.2.6
File Size Uploaded
cardiffwaste-0.2.6.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cardiffwaste 0.2.6
File Interpreter ABI Platform
cardiffwaste-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / cardiffwaste-0.2.6.tar.gz

Download URL cardiffwaste-0.2.6.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a0931d1e119052172cf3027917f9afad5d858d111be17d23a834a7c07e25f525
BLAKE2b-256 checksum
How to use checksums
d9ea62f0c3afdbbf875914c853f35f05ab6be329edf6151cb31670f854883d63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / cardiffwaste-0.2.6-py3-none-any.whl

Download URL cardiffwaste-0.2.6-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2768a1eb55859826f8f6b2b2932ca211a1133c1b1fb508b62b69aa901313c716
BLAKE2b-256 checksum
How to use checksums
d2ef0aa50186ac5fea42d53c0372c86619fb8903d1112e369f38f12c66935bff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14
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