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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8f4fb624c16e9a4f84838c01d38d06a3436c553422e72ce0a65d733e2a1226b
|
|
| MD5 |
5d4a1a8b33b8050b7250c9831005885c
|
|
| BLAKE2b-256 |
9adddce0f7930e7c5d8097623b7f4a10fb2895041b4b56ef98bedaf1926262bd
|
Provenance
The following attestation bundles were made for bma_opendata-0.1.0.tar.gz:
Publisher:
workflow.yml on Sosokker/bma-opendata-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bma_opendata-0.1.0.tar.gz -
Subject digest:
d8f4fb624c16e9a4f84838c01d38d06a3436c553422e72ce0a65d733e2a1226b - Sigstore transparency entry: 708529487
- Sigstore integration time:
-
Permalink:
Sosokker/bma-opendata-python-sdk@a2b6803c8d9efec6803e3167fc9475f32b3c9f52 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Sosokker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a2b6803c8d9efec6803e3167fc9475f32b3c9f52 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c370bdcd1d0d9b21c401cb50b6eb650bd80c63c2b527056e0d61464b0af7e673
|
|
| MD5 |
6bb080fa1b8ab4be8053ae93fcbfdb7c
|
|
| BLAKE2b-256 |
a9d168a2b2711e8d3ed0a68b166fab810242d0d3f9198bc062ef7f9d71f591be
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bma_opendata-0.1.0-py3-none-any.whl -
Subject digest:
c370bdcd1d0d9b21c401cb50b6eb650bd80c63c2b527056e0d61464b0af7e673 - Sigstore transparency entry: 708529488
- Sigstore integration time:
-
Permalink:
Sosokker/bma-opendata-python-sdk@a2b6803c8d9efec6803e3167fc9475f32b3c9f52 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Sosokker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a2b6803c8d9efec6803e3167fc9475f32b3c9f52 -
Trigger Event:
push
-
Statement type: