datagovsg.transport

Client for interacting with the Transport APIs.

Example usage:

# get the list of available taxis
from datagovsg import Transport
transport = Transport()
taxi_availability = transport.taxi_availability()

Methods

class datagovsg.transport.client.Client

Bases: DataGovSg

Interact with the transport-related endpoints.

Reference: https://data.gov.sg/datasets?formats=API&topics=transport

taxi_availability(**kwargs: Unpack[TransportArgsDict]) TaxiAvailabilityDict

Get locations of available taxis in Singapore.

Retrieved every 30 seconds from LTA’s Datamall.

Parameters:

kwargs (TransportArgsDict) – Key-value arguments to be passed as parameters to the endpoint URL.

Returns:

GeoJSON of the taxi availabilities. (Cached for 30 seconds.)

Return type:

TaxiAvailabilityDict

traffic_images(**kwargs: Unpack[TransportArgsDict]) TrafficImagesDict

Get the latest images from traffic cameras all around Singapore.

Retrieved every 20 seconds from LTA’s Datamall. But it is recommended to retrieve the data every minute.

Parameters:

kwargs (TransportArgsDict) – Key-value arguments to be passed as parameters to the endpoint URL.

Returns:

Images from traffic cameras. (Cached for 1 minute.)

Return type:

TrafficImagesDict

Types