Skip to main content

Async client library for the BIR Trash Collection API

Project description

birtrashclient

Async Python client for the BIR Trash Collection API.

Installation

pip install birtrashclient

Usage

import asyncio
from birtrashclient import BirTrashClient

async def main():
    client = BirTrashClient(app_id="your_app_id", contractor_id="your_contractor_id")
    await client.authenticate()

    address_id = await client.search_address("Storgata 1, Bergen")
    calendar = await client.get_calendar(address_id, "2024-01-01", "2024-12-31")

    for entry in calendar:
        print(entry)

    await client.close()

asyncio.run(main())

API

BirTrashClient(app_id, contractor_id, ...)

Parameter Type Default Description
app_id str required Application ID for API authentication
contractor_id str required Contractor ID for API authentication
request_timeout int 10 HTTP timeout in seconds
session aiohttp.ClientSession None Optional session to reuse
retries int 3 Retries on transient server errors
backoff_factor float 2.0 Exponential backoff base multiplier

Methods

  • authenticate() — Fetch and store an auth token
  • search_address(address) — Resolve a street address to a property ID
  • get_calendar(address_id, from_date, to_date) — Get pickup schedule (dates as YYYY-MM-DD)
  • close() — Close the underlying HTTP session

Exceptions

  • BirTrashAuthError — Authentication failure
  • BirTrashConnectionError — Connection or HTTP error after retries

License

MIT

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

birtrashclient-0.1.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

birtrashclient-0.1.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file birtrashclient-0.1.3.tar.gz.

File metadata

  • Download URL: birtrashclient-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for birtrashclient-0.1.3.tar.gz
Algorithm Hash digest
SHA256 81c23ba6bbb9871f44bd6e4cd1793a9f842b265b4e53beaa10da35cdc70d9dfe
MD5 e25904a7cb9e64dfeb883e92795f34a6
BLAKE2b-256 a1a04dd89ef9919b4f0458e7bacd9f1581e5699d40147018f9d0fd0a6bc20ab1

See more details on using hashes here.

Provenance

The following attestation bundles were made for birtrashclient-0.1.3.tar.gz:

Publisher: workflow.yml on eirikgrindevoll/birtrashclient

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

File details

Details for the file birtrashclient-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: birtrashclient-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for birtrashclient-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ecb95b253af25ea35d32e95a28afe5a806146fdf84c094b77639cc20ab605b
MD5 e6b1c70c7290dcdf16879c476bba7955
BLAKE2b-256 5894c7aa4dae41a7da9e727a4d8290e78ba9da84ab7f97e10297834f1cb57cde

See more details on using hashes here.

Provenance

The following attestation bundles were made for birtrashclient-0.1.3-py3-none-any.whl:

Publisher: workflow.yml on eirikgrindevoll/birtrashclient

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