Skip to main content

Typed SDK for the Bangkok Open Data CKAN Action API

Project description

Bangkok Open Data Python SDK

ไทย.


Lightweight wrapper around the Bangkok CKAN Action API with typed models, caching, and friendly error handling.

Installation

pip install bma-opendata

# or install from a local checkout for development
pip install -e .

Usage

import logging
from bma_opendata import BangkokOpenDataClient

logging.basicConfig(level=logging.INFO)

with BangkokOpenDataClient() as client:
    ids = client.list_datasets().result
    if ids:
        dataset = client.get_dataset(name=ids[0]).result
        logging.info("Dataset %s has %s resources", dataset.title, len(dataset.resources))

Examples

Additional runnable examples live under examples/ and cover listing datasets and searching with filters. Run them with your preferred tool, e.g.:

uv run python -m examples.list_datasets
uv run python -m examples.search_by_format --query water --format JSON

Headers & authentication

The portal occasionally blocks default python-requests clients.
The SDK now sends a browser-like User-Agent automatically; override it with the BMA_OPENDATA_USER_AGENT environment variable or by passing headers={"User-Agent": "..."}.
If you have a CKAN API token, either set BMA_OPENDATA_API_KEY or pass api_key= to the client to authorize requests.

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

bma_opendata-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

bma_opendata-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file bma_opendata-0.1.0.tar.gz.

File metadata

  • Download URL: bma_opendata-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bma_opendata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d8f4fb624c16e9a4f84838c01d38d06a3436c553422e72ce0a65d733e2a1226b
MD5 5d4a1a8b33b8050b7250c9831005885c
BLAKE2b-256 9adddce0f7930e7c5d8097623b7f4a10fb2895041b4b56ef98bedaf1926262bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bma_opendata-0.1.0.tar.gz:

Publisher: workflow.yml on Sosokker/bma-opendata-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bma_opendata-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bma_opendata-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bma_opendata-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c370bdcd1d0d9b21c401cb50b6eb650bd80c63c2b527056e0d61464b0af7e673
MD5 6bb080fa1b8ab4be8053ae93fcbfdb7c
BLAKE2b-256 a9d168a2b2711e8d3ed0a68b166fab810242d0d3f9198bc062ef7f9d71f591be

See more details on using hashes here.

Provenance

The following attestation bundles were made for bma_opendata-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on Sosokker/bma-opendata-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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