Giter Club home page Giter Club logo

cardiffwastepy's Introduction

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.

cardiffwastepy's People

Contributors

tombrien avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.