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.0
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.0.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bizkaibus-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.0 kB
Release files / bizkaibus-1.1.0.tar.gz
| Download URL | bizkaibus-1.1.0.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af75727d0fd69af193c27f0b94b0f59c4f5293f12a1e8723cad753c31dadbcdd
|
|
BLAKE2b-256 checksum How to use checksums |
3e0ea260dff56a3fb0335904c4d7bf501c69d4d0970d1cd573b44724f7fd5012
|
| 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.0-py3-none-any.whl
| Download URL | bizkaibus-1.1.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c27ef93947cc4a6c062f34eb60b0b1fc96699c23b982f74da1f30cf3b80de697
|
|
BLAKE2b-256 checksum How to use checksums |
131050c49c2f1331082a3331c6dd3100e0feeb3d0a75bb5e58394e1f44705bdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|