Skip to main content

Python package for interacting with APIs available at LTA DataMall

Project description

Python 3.13 PyPi PyPi status CodeCov coverage downloads GNU General Public License v3.0 Documentation Status

This is an unofficial Python package for interacting with APIs available at LTA DataMall.

Installing the package

Install the package using pip:

python -m pip install landtransportsg

Using the package

Pre-requisite:

The main steps are:

  1. Import a client class.

  2. Instantiate an object from the client class.

  3. Call a function on that object.

For more information, refer to the documentation.

Usage overview

Interacting with LTA DataMall’s API is done through one of four clients, where each client corresponds with a set of endpoints.

The five clients are:

  1. ActiveMobility

  2. ElectricVehicle

  3. Geospatial

  4. PublicTransport

  5. Traffic

Each client contains several public functions, one function per endpoint. A function’s name is the same as its corresponding endpoint’s ending path.

Some functions accept named arguments, where an argument corresponds with a parameter that the endpoint accepts.

Why have separate clients instead of one single client?

Without knowing how LTA DataMall’s API will evolve, and noticing that the endpoints were themselves already partitioned into sets, it seemed like a good idea to keep each set of endpoints in its own contextual client. This allows for each set of endpoints to be customised on their own, e.g. the PublicTransport passenger volume-related endpoints allow for a string to be returned, whereas the other endpoints return a list.

Reference

LTA DataMall’s Developer Guide

Other Packages Built by Me

If you like this package, you may be interested in these packages that I have built to work with other Government of Singapore APIs:

  • datagovsg: for interacting with APIs available at Data.gov.sg.

  • singstat: for interacting with APIs available at SingStat.gov.sg.

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

landtransportsg-2.2.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

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

landtransportsg-2.2.0-py3-none-any.whl (59.8 kB view details)

Uploaded Python 3

File details

Details for the file landtransportsg-2.2.0.tar.gz.

File metadata

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

File hashes

Hashes for landtransportsg-2.2.0.tar.gz
Algorithm Hash digest
SHA256 eceba1147a0bb7baebb95ae972e3042645316f417f45f76e16324577bf043918
MD5 e495abc8deee2364c97a6f88e969c2ff
BLAKE2b-256 3fc7e1f37a2a8d4c12d4b870e24d1887c05133046a76c2ed6e7df0b6cdc6f3db

See more details on using hashes here.

File details

Details for the file landtransportsg-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for landtransportsg-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6cfb3929f1828dd805d92e780c9ff8a8e18ea49d2097179b771d2504a42f9c
MD5 b49f929e6f263ff4f5b91b4a3960da4f
BLAKE2b-256 d0d26d93314236b1247140064b72cfc96d1aa2cb317aee720b7cd9f8cbd41aab

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