# 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:
```bash
pip install bus_times
```
Alternatively, you can install it directly from the source:
```bash
git clone https://github.com/yourusername/bus_times.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.
```python
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
```json
{
"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.
Raw data
{
"_id": null,
"home_page": "https://github.com/t0mer/py-busnearby",
"name": "busnearby",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "public transportation, bus, trains, home automation",
"author": "Tomer Klein",
"author_email": "tomer.klein@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/68/7a401d6c9ae15b48159bd6aa5412126122ed3e420987af07e06576d2d9ae/busnearby-0.1.2.tar.gz",
"platform": null,
"description": "# py-busnearby\nA Python library to get bus times from the Bus Nearby API https://www.busnearby.co.il/\n\n\n## Installation\n\nYou can install the library from PyPI:\n\n```bash\npip install bus_times\n```\n\nAlternatively, you can install it directly from the source:\n\n```bash\ngit clone https://github.com/yourusername/bus_times.git\ncd bus_times\npip install .\n```\n\n## Usage\nHere are some examples of how to use the library:\n\n\n## Get Bus Times\nTo get bus times for a specific station and bus lines, you can use the get_bus_times function.\n\n```python\nfrom busnearby import BusNearBy\nimport asyncio\n\nbus = BusNearBy()\n\nasync def main():\n station = \"34501\"\n bus_lines = \"609,636,10,15\"\n try:\n result = await bus.get_bus_times(station, bus_lines)\n print(result)\n except ValueError as e:\n print(f\"Error: {e}\")\n except RuntimeError as e:\n print(f\"Error: {e}\")\n\nasyncio.run(main())\n```\n\n## Example Output\n\n```json\n{\n \"stationName\": \"\u05e9\u05d3\u05e8\u05d5\u05ea \u05d5\u05d9\u05d9\u05e6\u05de\u05df/\u05e2\u05e7\u05d9\u05d1\u05d0\",\n \"time\": \"2024-07-22 13:10:43.974935\",\n \"buses\": [\n {\n \"lineNumber\": \"10\",\n \"arrivalSeconds\": 644\n },\n {\n \"lineNumber\": \"15\",\n \"arrivalSeconds\": 1501\n },\n {\n \"lineNumber\": \"609\",\n \"arrivalSeconds\": 2210\n },\n {\n \"lineNumber\": \"636\",\n \"arrivalSeconds\": 3532\n },\n {\n \"lineNumber\": \"636\",\n \"arrivalSeconds\": 6728\n }\n ]\n}\n```\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request on GitHub.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library to get bus times from the Bus Nearby API",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://github.com/t0mer/py-busnearby",
"Download": "https://github.com/t0mer/py-busnearby/",
"Homepage": "https://github.com/t0mer/py-busnearby",
"Source": "https://github.com/t0mer/py-busnearby"
},
"split_keywords": [
"public transportation",
" bus",
" trains",
" home automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "65dbbcac1b3e1b679cd7b2d8afd650f985330936f4bec7d51c89758f4f01a215",
"md5": "94c65229aaf311cdcb2cf99dcf5b3cb7",
"sha256": "f104db62dac0235a575b383ca9a18b44a3cc572fb6fefb2f3926cad524a7e870"
},
"downloads": -1,
"filename": "busnearby-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "94c65229aaf311cdcb2cf99dcf5b3cb7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7271,
"upload_time": "2024-07-22T10:15:39",
"upload_time_iso_8601": "2024-07-22T10:15:39.917666Z",
"url": "https://files.pythonhosted.org/packages/65/db/bcac1b3e1b679cd7b2d8afd650f985330936f4bec7d51c89758f4f01a215/busnearby-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ea687a401d6c9ae15b48159bd6aa5412126122ed3e420987af07e06576d2d9ae",
"md5": "327ed5b00030cfe389922793376cfc72",
"sha256": "24ea435b19fe1f89a9d465b11d84230945c0c8a941cdaf292325a652f93776b6"
},
"downloads": -1,
"filename": "busnearby-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "327ed5b00030cfe389922793376cfc72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7047,
"upload_time": "2024-07-22T10:15:47",
"upload_time_iso_8601": "2024-07-22T10:15:47.409226Z",
"url": "https://files.pythonhosted.org/packages/ea/68/7a401d6c9ae15b48159bd6aa5412126122ed3e420987af07e06576d2d9ae/busnearby-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-22 10:15:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "t0mer",
"github_project": "py-busnearby",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "busnearby"
}