Skip to main content

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

Project description

Python 3 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:

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 deprecated.

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.0.0.tar.gz (59.9 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.0.0-py3-none-any.whl (63.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datagovsg-2.0.0.tar.gz
  • Upload date:
  • Size: 59.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for datagovsg-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8994ce1de9142e7362cc6c5c42e89f722088b7d065fa9842028450a9dd8157c6
MD5 509e366c2091e321eca588b556b04a9d
BLAKE2b-256 614b2447a94a6b629937e113c6bedfd686171cd5b680595d469c946f63bcd4b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datagovsg-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 63.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for datagovsg-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8de406f2346179bbcfd0223f8505b16a9ffb1fcbeaf952a2aae3516f3153a42d
MD5 1ff77df78058550711b0ec7852b0aa9a
BLAKE2b-256 0dca085277fa62fd0c0c92ea3c64f31f0899d8b4dc24a101ff5a1a55602d5a67

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