Skip to main content

Async Python client for the BIR waste collection API

Project description

pybirno

CI PyPI Python License

Async Python client for the BIR waste collection API. BIR handles garbage collection in the Bergen region of Norway. This library wraps a small part of their API (address lookup, auth, and pickup schedules) and was made to power the Home Assistant BIR integration.

Installation

pip install pybirno

Usage

Fetching pickups

import asyncio
from aiohttp import ClientSession
from pybirno import BirClient

async def main():
    async with ClientSession() as session:
        client = BirClient("property-id", session)
        pickups = await client.get_pickups()
        for pickup in pickups:
            print(f"{pickup.waste_type}: {pickup.date}")

asyncio.run(main())

Searching for addresses

Find your property ID by searching for an address:

async def find_address():
    async with ClientSession() as session:
        addresses = await BirClient.search_addresses(session, "Testveien 1")
        for addr in addresses:
            print(f"{addr.address} (ID: {addr.property_id})")

Error handling

from pybirno import BirClient, BirAuthenticationError, BirConnectionError

async def safe_fetch():
    async with ClientSession() as session:
        client = BirClient("property-id", session)
        try:
            pickups = await client.get_pickups()
        except BirAuthenticationError:
            print("Authentication failed")
        except BirConnectionError:
            print("Could not reach BIR API")

API Documentation

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Security

See SECURITY.md for reporting vulnerabilities.

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

pybirno-0.2.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

pybirno-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pybirno-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for pybirno-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dfb19dde240828fd16f478ad2cc89e9b3019b2e7eaf6633daa7c42b37040bc91
MD5 b102af72ab158c7f0cd1b8eac4a03008
BLAKE2b-256 8ea728051681f974bd3fcab4a20cfc6ab83634a253f95e8e428c2eb938b5cf5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybirno-0.2.0.tar.gz:

Publisher: publish.yml on SanderBlom/pybirno

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

File details

Details for the file pybirno-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pybirno-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdf6c3c7950347436c01e9ff3b0897681a13aac2ceba39a1a91415f865d3f26f
MD5 d5a4610b5276bf9f20535736c5671c49
BLAKE2b-256 b2dd3d28c417c357c80b39e2666c41a9964ce71bea555eea897dea186f51441d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybirno-0.2.0-py3-none-any.whl:

Publisher: publish.yml on SanderBlom/pybirno

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