Skip to main content

ods-utils-py

With ods-utils-py, the Automation API from Opendatasoft can be accessed directly from Python. A valid API key is required (Create an API key). The source code is publicly available on GitHub.

Installation

Installation via pip:

pip install ods-utils-py

Requirements

  • Python Version: 3.11 or higher
  • API Key: A valid API key from Opendatasoft

Getting Started

Set up API Key

To use ods-utils-py, a valid API key from Opendatasoft is required.

For OGD Basel, the API key can be created here.

For key creation on other platforms, click on the username button in the top right corner to open account settings. Under API Keys, custom keys with the appropriate permissions can be created.

The name should describe its purpose, for example, "ods_utils_py - <Initial Key Name>"

The API key requires the following 4 permissions:

  • Browse all datasets
  • Create new datasets
  • Edit all datasets
  • Publish own datasets

The API key is then required as an environment variable.

Set up Environment Variables

Next, the environment variables must be defined. For this, add a .env file in the root directory with the following content. If a .env already exists, just append the following content:

ODS_API_KEY=your_ods_api_key

ODS_DOMAIN=data.bs.ch
ODS_API_TYPE=automation/v1.0

Important: Make sure to add **/.env to your .gitignore to not upload the credentials to the internet!

Usage

Here's a simple example to retrieve the number of datasets:

import ods_utils_py as ods_utils

num_datasets = ods_utils.get_number_of_datasets()
print(f"We currently have {num_datasets} datasets.")

A list of all currently implemented functions can be found on GitHub.

If a desired function does not exist, it can be implemented via _requests_utils:

import ods_utils_py as ods_utils

response = ods_utils._requests_utils.requests_get("https://www.example.com")
print(response.text)

Note: Most of these functions should eventually be integrated into ods_utils_py if they use the Automation API.


Further Links

The complete documentation of the Automation API 1.0 can be found here.


License

This project is licensed under the MIT License. See the LICENSE file in the repository for the full license text.


Release files for ods-utils-py 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ods-utils-py 0.2.6
File Size Uploaded
ods_utils_py-0.2.6.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ods-utils-py 0.2.6
File Interpreter ABI Platform
ods_utils_py-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size:33.2 kB

Release files / ods_utils_py-0.2.6.tar.gz

Download URL ods_utils_py-0.2.6.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
998b8690fd0c46391d4e60628263b341732a3daca4125492e865dd63a45b80b6
BLAKE2b-256 checksum
How to use checksums
906c64925103f69075485a682dbb55c9c7fb6e6060e3aef9a35d45e46200ddfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / ods_utils_py-0.2.6-py3-none-any.whl

Download URL ods_utils_py-0.2.6-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5530ed500a51b9cd6a83445e7601130460afd9807fa70198062a9c4b3060725
BLAKE2b-256 checksum
How to use checksums
e1b8a9a0f0d290f20b4e440764e00ae134c373fc172ead9d2217a09098bc7a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page