Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctabustracker_v2-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctabustracker_v2-1.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

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

Hashes for ctabustracker_v2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5d1c7014bd605e7e598d20c30a1a2d4439180df3fedb2a9b0f0730df8b84a3f4
MD5 00ea93b321a1758997a86f8aa5a5cc85
BLAKE2b-256 218e65314c44047e09b6cfeb96459fb1bba3bec146f7a76f4f086ac4376de9cb

See more details on using hashes here.

File details

Details for the file ctabustracker_v2-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ctabustracker_v2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 605e279e64a9f54ce9e79fc9566d2375ac63006ad0d6664de49d3d62dd0ef2f5
MD5 82c4f70c429ee394a4203646e6c84480
BLAKE2b-256 84aea353427da0fdf1158325f4013f3cc7d6c947421ca6e2cffe45e8f55390ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page