A Python 3 wrapper for the CTA Bus Tracker API (v2).
Project description
CTA Bus Tracker API Wrapper
A simple Python 3 client for the Chicago Transit Authority (CTA) Bus Tracker API. This library wraps common endpoints, providing a straightforward way to query real-time bus information such as routes, directions, stops, and predictions.
Features
- Fetch current system time from CTA Bus Tracker
- Get vehicles by route or vehicle ID
- Get predictions by stop ID, vehicle ID, or route
- List all currently enabled routes
- Retrieve directions for a route
- Retrieve stops for a route + direction
- Retrieve patterns (geospatial paths)
- Retrieve service bulletins
Requirements
- Python 3.7+
Installation
pip install ctabustracker-api-v2
Usage
YOUR_CTA_API_KEY = "YOUR_API_KEY_HERE"
cta_client = CTABusTrackerAPI(YOUR_CTA_API_KEY)
# Get system time
time_response = cta_client.get_time()
print("System Time:", time_response)
# Get all routes
routes_response = cta_client.get_routes()
print("All Routes:", routes_response)
# Example: get directions for route #22
directions_response = cta_client.get_directions("22")
print("Directions for Route 22:", directions_response)
# Example: get stops for route #22, Eastbound
stops_response = cta_client.get_stops("22", "Eastbound")
print("Stops for Route 22 Eastbound:", stops_response)
# Example: get predictions for stop(s)
# (Replace 'STOP_ID' with a valid stop ID from above stops_response)
predictions_response = cta_client.get_predictions(stpid=["STOP_ID"])
print("Predictions for STOP_ID:", predictions_response)
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 ctabustracker_v2-1.0.0.tar.gz.
File metadata
- Download URL: ctabustracker_v2-1.0.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1c7014bd605e7e598d20c30a1a2d4439180df3fedb2a9b0f0730df8b84a3f4
|
|
| MD5 |
00ea93b321a1758997a86f8aa5a5cc85
|
|
| BLAKE2b-256 |
218e65314c44047e09b6cfeb96459fb1bba3bec146f7a76f4f086ac4376de9cb
|
File details
Details for the file ctabustracker_v2-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ctabustracker_v2-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
605e279e64a9f54ce9e79fc9566d2375ac63006ad0d6664de49d3d62dd0ef2f5
|
|
| MD5 |
82c4f70c429ee394a4203646e6c84480
|
|
| BLAKE2b-256 |
84aea353427da0fdf1158325f4013f3cc7d6c947421ca6e2cffe45e8f55390ea
|