Get bus predictions from NextBus
Project description
Bus Tracker (NextBus)
Python module to get bus data from NextBus
This is an ongoing project. If you have any requests or contributions, please create a ticket
Install
From PyPI with pip
pip install bustracker
Usage examples
from bustracker import BusTracker
# Agency list is from http://webservices.nextbus.com/service/publicXMLFeed?command=agencyList
agency = 'ttc'
bus = BusTracker(agency)
# get prediction for bus stops
stops = [
{'routeTag': 506, 'stopTag': 3292}
]
predictions = bus.get_predictions(stops)
print(predictions)
The result is a dictionary of predictions
{
"predictions": {
"message": {
"text": "TTC Information 416-393-4636 (INFO)",
"priority": "Normal"
},
"agencyTitle": "Toronto Transit Commission",
"routeTag": "506",
"routeTitle": "506-Carlton",
"direction": {
"title": "West - 506 Carlton towards High Park",
"prediction": [
{
"isDeparture": "false",
"minutes": "2",
"seconds": "134",
"tripTag": "38216487",
"vehicle": "4189",
"block": "506_9_90",
"branch": "506",
"dirTag": "506_1_506",
"epochTime": "1563543576881"
},
...
]
},
"stopTitle": "Gerrard St East At Jones Ave",
"stopTag": "3292"
},
"copyright": "All data copyright Toronto Transit Commission 2019."
}
For development
Testing
pytest tests/test.py
References
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
bustracker-0.0.3.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file bustracker-0.0.3.tar.gz
.
File metadata
- Download URL: bustracker-0.0.3.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9784ac271f281072ea652d6cb97014504e3b2d81c58399eca1db9cd08c987416 |
|
MD5 | 43d7e9037fa68ef1ed21c9415d42cde1 |
|
BLAKE2b-256 | 4c63218f025cab03da7a18389ade72935c51124c929f70094d5905a42d0d5a65 |
File details
Details for the file bustracker-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: bustracker-0.0.3-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2dfbb983b3fd2149fce5a898ed3250a54feb3eec591b1137e52a49f757bbc88 |
|
MD5 | e4b7e9bbdcca0eeb362d54ec618dcbed |
|
BLAKE2b-256 | 3bb4ce39e7405aaee6dcdb66cc7401cf8a855f37abbcd4a7fbdb161b5d765822 |