Skip to main content

Python client for Lewisham Council civic data — bin collection schedules and address resolution.

Reason this release was yanked:

accidental release, incorrect version number

Project description

lewisham-council-client

Framework-neutral Python client for Lewisham Council civic data. Provides asynchronous address resolution and waste collection schedule retrieval for any Lewisham UPRN.

No dependency on FastAPI, Home Assistant, MCP, uvicorn, or any web framework. Designed to be embedded directly in another Python application.

Unofficial — not affiliated with or endorsed by Lewisham Council. Uses undocumented public endpoints that may change without notice; the client raises UpstreamScraperChangedError when the response shape no longer matches expectations.

Installation

pip install lewisham-council-client

Usage

import asyncio
from lewisham_client import LewishamService

async def main() -> None:
    service = LewishamService()
    try:
        addresses = await service.lookup_addresses("SE6 1SQ")
        for address in addresses:
            print(address.uprn, address.title)

        if addresses:
            schedule = await service.get_collection_schedule(addresses[0].uprn)
            for entry in schedule.collections:
                print(entry.waste_type, entry.frequency, entry.next_collection)
    finally:
        await service.aclose()

asyncio.run(main())

LewishamService creates and manages its own httpx.AsyncClient by default. If the host application already manages a shared httpx.AsyncClient, pass it via LewishamClient:

import httpx
from lewisham_client import LewishamClient, LewishamService

async with httpx.AsyncClient() as http:
    service = LewishamService(client=LewishamClient(http_client=http))
    schedule = await service.get_collection_schedule(uprn)

Errors

All errors are subclasses of lewisham_client.DomainError:

Exception When
InvalidAddressSearchError Search input is too short or malformed.
InvalidUprnError UPRN is not a non-empty decimal string.
AddressNotFoundError No Lewisham address found for the given UPRN.
CollectionScheduleNotFoundError Lewisham returned no parseable schedule for the address.
UpstreamScraperChangedError Lewisham's response shape no longer matches expectations.
UpstreamUnavailableError Lewisham could not be reached (timeout or transport error).

Caching

LewishamService uses an in-process MemoryTtlCache by default with conservative TTLs (schedules: 24 h, address searches: 7 d, UPRNs: 30 d, negative results: 1 h). The defaults are suitable for a single-process consumer such as a Home Assistant integration.

Injectable cache and TTL parameters are available for consumers that need different policy or a shared cache.

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

lewisham_council_client-0.0.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

lewisham_council_client-0.0.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file lewisham_council_client-0.0.0.tar.gz.

File metadata

  • Download URL: lewisham_council_client-0.0.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lewisham_council_client-0.0.0.tar.gz
Algorithm Hash digest
SHA256 7b9ce30f86df581dac783435f558a47d2e5d16711bbf0871a18565446bcf097c
MD5 6dfb73fc73118ce050cc65a983ec65cc
BLAKE2b-256 bab743c762db8c7da1c244f8ff6d65d10fc8dcd2a42293f07173f3126e817984

See more details on using hashes here.

Provenance

The following attestation bundles were made for lewisham_council_client-0.0.0.tar.gz:

Publisher: publish.yml on OliverFarren/lewisham-council-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lewisham_council_client-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lewisham_council_client-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c038a61529fdbc381f7323e87087e851effcc2c76f9a2c24b08bf05529be8415
MD5 1725c9b4f283931b333d0addee88ecb2
BLAKE2b-256 c565f1b50b329fdf524f625bb7488e376bf374f4b6f08d24bba8ac8d1832fa96

See more details on using hashes here.

Provenance

The following attestation bundles were made for lewisham_council_client-0.0.0-py3-none-any.whl:

Publisher: publish.yml on OliverFarren/lewisham-council-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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