A library to get bus times from the Bus Nearby API
Project description
py-busnearby
A Python library to get bus times from the Bus Nearby API https://www.busnearby.co.il/
Installation
You can install the library from PyPI:
pip install busnearby
Alternatively, you can install it directly from the source:
git clone https://github.com/t0mer/py-busnearby.git
cd bus_times
pip install .
Usage
Here are some examples of how to use the library:
Get Bus Times
To get bus times for a specific station and bus lines, you can use the get_bus_times function.
from busnearby import BusNearBy
import asyncio
bus = BusNearBy()
async def main():
station = "34501"
bus_lines = "609,636,10,15"
try:
result = await bus.get_bus_times(station, bus_lines)
print(result)
except ValueError as e:
print(f"Error: {e}")
except RuntimeError as e:
print(f"Error: {e}")
asyncio.run(main())
Example Output
{
"stationName": "שדרות וייצמן/עקיבא",
"time": "2024-07-22 13:10:43.974935",
"buses": [
{
"lineNumber": "10",
"arrivalSeconds": 644
},
{
"lineNumber": "15",
"arrivalSeconds": 1501
},
{
"lineNumber": "609",
"arrivalSeconds": 2210
},
{
"lineNumber": "636",
"arrivalSeconds": 3532
},
{
"lineNumber": "636",
"arrivalSeconds": 6728
}
]
}
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file busnearby-0.1.3.tar.gz.
File metadata
- Download URL: busnearby-0.1.3.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0c2dd52be807093afdd2e03eebca47c0bdfbcdc4990452f3e8e0048cd30cb96
|
|
| MD5 |
154cd2ec76689ec7901d0290d2e3e43d
|
|
| BLAKE2b-256 |
74a4b3e4dc32e8cec03efa105493979c02f589993a3578617c98c24e32b2700e
|
File details
Details for the file busnearby-0.1.3-py3-none-any.whl.
File metadata
- Download URL: busnearby-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f97ca72236696218c71c3e94a1425fbf47ba309e3082dd7d3a59479a4bd8e09
|
|
| MD5 |
67a120711862a69a29ca9e1cb4cbde7b
|
|
| BLAKE2b-256 |
35e51d6acde10ef6721488228ceb0867d23b15ced226b5532dd8c1df564af866
|