A Python library for the Chicago Transit Authority (CTA) API - track buses and trains in real-time.
Data provided by CTA
- 🚌 Bus Tracking - Real-time bus locations, predictions, and routes
- 🚊 Train Tracking - L train arrivals, positions, and station info
- ⚡ Async Support - Both synchronous and asynchronous operations
- 📝 Type Safety - Optional Pydantic models for data validation
- 🔧 Simple API - Easy-to-use interface matching CTA's official API
uv add windytracker[all] # All features (recommended)
uv add windytracker[sync] # Sync only
uv add windytracker[async] # Async onlyOr with pip:
pip install windytracker[all]- Register at CTA Developer Portal
- Request API access and wait for approval
from windytracker import BusTracker
# Initialize with your API key
tracker = BusTracker(key="your_api_key")
# Get next buses at a stop
predictions = tracker.getpredictions(stpid="1001")
# Get all routes
routes = tracker.getroutes()import asyncio
from windytracker import AsyncBusTracker
async def main():
async with AsyncBusTracker(key="your_api_key") as tracker:
predictions = await tracker.getpredictions(stpid="1001")
print(predictions)
asyncio.run(main())| Class | Sync/Async | Raw/Pydantic | Use Case |
|---|---|---|---|
BusTracker |
Sync | Raw JSON | Simple bus tracking |
AsyncBusTracker |
Async | Raw JSON | Async bus tracking |
TypedBusTracker |
Sync | Pydantic | Type-safe bus tracking |
AsyncTypedBusTracker |
Async | Pydantic | Type-safe async bus tracking |
TrainTracker |
Sync | Raw JSON | Simple train tracking |
AsyncTrainTracker |
Async | Raw JSON | Async train tracking |
TypedTrainTracker |
Sync | Pydantic | Type-safe train tracking |
AsyncTypedTrainTracker |
Async | Pydantic | Type-safe async train tracking |
Full documentation is available at: https://rynoxli.github.io/windytracker
git clone https://github.com/RynoXLI/windytracker.git
cd windytracker
uv sync --all-extrasuv run mkdocs serveThis project is subject to the CTA Developer License Agreement.
Data provided by Chicago Transit Authority. WindyTracker is not affiliated with, endorsed by, or sponsored by CTA.
Contributions welcome! Please see our contributing guidelines.