Skip to main content

Python package for interacting with APIs available at Data.gov.sg

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 Data.gov.sg.

Installing the package

Install the package using pip:

python -m pip install datagovsg

Using the package

The main steps are:

  1. Import a class.

  2. Instantiate an object from the class.

  3. Call a function on that object.

For more information, refer to the documentation.

Usage overview

Interacting with Data.gov.sg’s API is done through one of four clients, where each client corresponds with a “set” of endpoints. (Data.gov.sg doesn’t categorise its endpoints by set, but it can be assumed from the endpoints’ path directories.)

The four clients are: Economy, Environment, Housing and Transport.

Breaking changes from v1.x

The Economy client used to be called Technology.

The old Transport client has been separated into Housing and Transport.

Data.gov.sg no longer provides endpoints for CKAN, so the Ckan client has been removed.

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

Most 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 Data.gov.sg’s API will evolve, and noticing that Data.gov.sg uses “Categories” to group its endpoints, 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 Environment endpoints allow for either a date or date-time to be specified, whereas the Transport endpoints don’t.

Reference

Data.gov.sg’s Developer Guide

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

datagovsg-2.2.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

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

datagovsg-2.2.0-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for datagovsg-2.2.0.tar.gz
Algorithm Hash digest
SHA256 c80ca0c0a4fa52ea10f5cf928bf96853222c61316464eba3f87eef71367d40f7
MD5 4d4ce163d4829ad1fbae0c49fe0a89f6
BLAKE2b-256 63e3b3bd1df306d797d1b48ef8a34046fb7d5514fb8a2e22c754c5294b4d3f9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datagovsg-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for datagovsg-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 135b974acb5505f7679cfe74a884595e433d1128f21b6b02b640ddc7527f362a
MD5 b74f59c57675368ca8a2da107bd49103
BLAKE2b-256 04e303514409c260859528d0115753fb51d440b5939920fbb54d7018f4b1d2dc

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