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.0.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.0.1.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bizkaibus-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / bizkaibus-1.0.1.tar.gz
| Download URL | bizkaibus-1.0.1.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b78ba24183fb6576d2d78f204e1f459762a64561c0da8020313f2d4008d1e792
|
|
BLAKE2b-256 checksum How to use checksums |
1f8ae83ca61bc1fae6c36b618bf27b52cb8519d10370dcc7ccc501681a2cfec3
|
| 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.0.1-py3-none-any.whl
| Download URL | bizkaibus-1.0.1-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63888387befa58839e41c41f2def235195cfd9a506dbe8b47df78a168ea11403
|
|
BLAKE2b-256 checksum How to use checksums |
7929a916b37d4c76fa26e249a6b2614eb2f6ae95a0121da42ee54522baed0dd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|