BizkaibusRTPI
Async client to query real-time information of Bizkaibus buses.
Installation
pip install bizkaibus
Basic usage
import asyncio
from bizkaibus import BizkaibusAPI
from bizkaibus.Model.BizkaibusLanguages import BizkaibusLanguages
async def main():
api = await BizkaibusAPI.create(BizkaibusLanguages.EU, "0296")
async with api:
timetable = await api.get_timetable()
print(timetable)
asyncio.run(main())
Get lines for a stop
async def main():
api = await BizkaibusAPI.create(BizkaibusLanguages.ES, "0296")
async with api:
lines = await api.get_lines_on_stop()
for line in lines:
print(line)
Error handling
The client raises the following exceptions, all available from bizkaibus:
BizkaibusConnectionErrorwhen a request times out, cannot connect, receives a non-200 HTTP status, or the service reports a failure.BizkaibusStopNotFoundErrorwhen the requested stop does not exist.BizkaibusParseErrorwhen the service returns malformed or unexpected data.
from bizkaibus import (
BizkaibusConnectionError,
BizkaibusParseError,
BizkaibusStopNotFoundError,
)
try:
api = await BizkaibusAPI.create(BizkaibusLanguages.EU, "0296")
async with api:
timetable = await api.get_timetable()
except BizkaibusStopNotFoundError:
print("The requested stop does not exist")
except BizkaibusConnectionError:
print("Could not contact the Bizkaibus service")
except BizkaibusParseError:
print("The Bizkaibus service returned an invalid response")
Features
- Stop timetable lookup
- Stop line lookup
- Incident retrieval by language
- Async support with
asyncioandaiohttp
Development
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest
License
MIT
Metadata
Release files for bizkaibus 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bizkaibus-1.1.1.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bizkaibus-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.0 kB
Release files / bizkaibus-1.1.1.tar.gz
| Download URL | bizkaibus-1.1.1.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9226cc12d54e56d52037237091aa5eb4aaf8e30e30777b5ad35751295181913
|
|
BLAKE2b-256 checksum How to use checksums |
ed561b33cd8f4a64e1a685a9304065dfd6cd872e5aefc10c00d938eaf897b1b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / bizkaibus-1.1.1-py3-none-any.whl
| Download URL | bizkaibus-1.1.1-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b724ac22747aafea7637f8055835ad27b0ba8ed8819b3f465c38a3bdcef0f780
|
|
BLAKE2b-256 checksum How to use checksums |
8ecdc05470c37e7a1eae348b23b845e2a1a4b05fa810b97d5f5c3d36dcbdb3c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|