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