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:

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.1.0.tar.gz (39.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.1.0-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for datagovsg-2.1.0.tar.gz
Algorithm Hash digest
SHA256 2d721898b88e7983ad61786d407249e6550dccf56405ad3a7d0abdfe3b6d6aee
MD5 92386b845cbb3ef17c5fb1393f2ad0db
BLAKE2b-256 640452d97fb68acf16f41194d1d659b60f07083d24e0a43df096a0490e3a94de

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for datagovsg-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b52a9f2d5c1b3682f5250f4f26b3e34b34226643c838b962b549ffe033d2f5d
MD5 573c431d57ba5e2d44398b15c0510d97
BLAKE2b-256 3eb4f6609e145835d90c90a264b93f96f209b8f627b9d0829d62e5fd62135fa1

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