GTFS-realtime

GTFS-realtime is a specification for sharing real-time transit information. It’s primarily ingested by Google in order to power transit information within Google Maps.

See also

TransLink’s GTFS-realtime API reference. Much of it is replicated here for convenience. However, the docs here reflect Tilapya-specific behaviour.

Usage example

Request the real-time positions feed.
 >>> from tilapya import GTFSRT
 >>> api = GTFSRT('my key')
 >>> api.position()
 <Response [200]>

The protobuf data in response.content can then be deserialized.

API reference

class tilapya.GTFSRT(api_key, session=None)[source]

The wrapper around TransLink’s endpoints for GTFS-realtime datasets.

Parameters:
  • api_key – TransLink API key.
  • session (requests.Session) – Session to use, instead of the default.
position()[source]

Request the position feed.

Returns:The response. The raw protobuf data is in content.
Return type:requests.Response
service_alerts()[source]

Request the service alerts feed.

Returns:The response. The raw protobuf data is in content.
Return type:requests.Response
trip_updates()[source]

Request the trip updates feed.

Returns:The response. The raw protobuf data is in content.
Return type:requests.Response