Skip to main content

A Python wrapper for the GO Transit GTFS API

Project description

GO Transit GTFS Wrapper

License Issues

The GO Transit GTFS wrapper for simplifies access to the GO Transit / Metrolinx Open Data API.

Features

  • Access next service times for stops
  • Retrieve stop details and destinations
  • Query train and bus schedules
  • Fetch General Transit Feed Specification (GTFS) feeds: alerts, trip updates, vehicle positions
  • Service updates: alerts, marketing, exceptions
  • Fare lookup between stops
  • Modular design: Client routes requests to endpoint classes (e.g., Stop, Schedule)

Installation

GO Transit GTFS wrapper is supported on Python 3.10+. It can be installed via pip:

pip install gotransit

Quickstart

You must have a GO Transit API key to access GTFS information. You can apply for an API key here.
Once you have an API key, you can instantiate a client like so:

import gotransit

go_client = gotransit.Client(api_key="API_KEY")

You can pass the go_client instance into distinct endpoints to organize access:

import json
import gotransit

go_client = gotransit.Client(api_key="API_KEY")

# Pass the main client to the Stop endpoint
stop_api = gotransit.Stop(go_client)

# We want Stop information for Union Station, code 'UN'
stop_code = "UN"

# Request and store the result of the Next Service endpoint with the 'UN' stop code
data = stop_api.next_service(stop_code)

# Format and dump the result to a local JSON file for easy viewing
with open("union_station_stops.json", "w", encoding="utf-8") as f:
    json.dump(data, f, indent=4)

print("API Response ==> union_station_stops.json")

Refer to the GO API documentation for a comprehensive list of available endpoints.

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

gotransit-1.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

gotransit-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file gotransit-1.0.0.tar.gz.

File metadata

  • Download URL: gotransit-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gotransit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e43af32f12c289a9ccf35a818d5f4d538da1af5fe3050392cfcbfe67ac79eb85
MD5 2bc68017e452ca805b7b189f6896d4f1
BLAKE2b-256 a61361517344751228ffe9230a7871a8ec75cab25da1b7fef2e2194c1b2316a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gotransit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gotransit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a473e9ecb68f642422785d3b2a9f3ff31240b6140bfc8ea4a988a3a4dc4ee249
MD5 efc046829246267ba484e0e6c10bf7ae
BLAKE2b-256 59ee27b0df61e368c74bc5ff51755b11fd3832f31e7a34f60642e72dc28b2f44

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