Skip to main content

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.

Metadata

Release files for busnearby 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for busnearby 0.1.3
File Size Uploaded
busnearby-0.1.3.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for busnearby 0.1.3
File Interpreter ABI Platform
busnearby-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / busnearby-0.1.3.tar.gz

Download URL busnearby-0.1.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e0c2dd52be807093afdd2e03eebca47c0bdfbcdc4990452f3e8e0048cd30cb96
BLAKE2b-256 checksum
How to use checksums
74a4b3e4dc32e8cec03efa105493979c02f589993a3578617c98c24e32b2700e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / busnearby-0.1.3-py3-none-any.whl

Download URL busnearby-0.1.3-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f97ca72236696218c71c3e94a1425fbf47ba309e3082dd7d3a59479a4bd8e09
BLAKE2b-256 checksum
How to use checksums
35e51d6acde10ef6721488228ceb0867d23b15ced226b5532dd8c1df564af866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page