Python client for Lewisham Council civic data — bin collection schedules and address resolution.
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
UpstreamScraperChangedErrorwhen 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lewisham_council_client-0.1.0.tar.gz.
File metadata
- Download URL: lewisham_council_client-0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1cfec7e9353b16897bd18f1ccc84d0af7e8416d5e0b22ea74befe9c86081235
|
|
| MD5 |
7da7c49195df8663cba281ef1213ed26
|
|
| BLAKE2b-256 |
cb64a3b1ff1095dec4a92e96f7b009065b9e816e3c2301142834b23479baaac4
|
Provenance
The following attestation bundles were made for lewisham_council_client-0.1.0.tar.gz:
Publisher:
publish.yml on OliverFarren/lewisham-council-scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lewisham_council_client-0.1.0.tar.gz -
Subject digest:
d1cfec7e9353b16897bd18f1ccc84d0af7e8416d5e0b22ea74befe9c86081235 - Sigstore transparency entry: 1999286842
- Sigstore integration time:
-
Permalink:
OliverFarren/lewisham-council-scraper@ede67277a3bbd17d675528245c5f9eca865ed163 -
Branch / Tag:
refs/tags/lewisham-council-client-v0.1.0 - Owner: https://github.com/OliverFarren
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ede67277a3bbd17d675528245c5f9eca865ed163 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lewisham_council_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lewisham_council_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6705916eac0d9764ee2db4b2c2587c893df6f4d0e2aec49897d78796d7f4952
|
|
| MD5 |
67fb2490ca26aadb825f554a9c108502
|
|
| BLAKE2b-256 |
e014c04713d610dde06f0bc187f16866c2a203bf03a6518d7a5713faaad71cb8
|
Provenance
The following attestation bundles were made for lewisham_council_client-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on OliverFarren/lewisham-council-scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lewisham_council_client-0.1.0-py3-none-any.whl -
Subject digest:
e6705916eac0d9764ee2db4b2c2587c893df6f4d0e2aec49897d78796d7f4952 - Sigstore transparency entry: 1999286955
- Sigstore integration time:
-
Permalink:
OliverFarren/lewisham-council-scraper@ede67277a3bbd17d675528245c5f9eca865ed163 -
Branch / Tag:
refs/tags/lewisham-council-client-v0.1.0 - Owner: https://github.com/OliverFarren
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ede67277a3bbd17d675528245c5f9eca865ed163 -
Trigger Event:
push
-
Statement type: