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