Unofficial python client for `data.gouv.fr`
Project description
datagouv-python
Unofficial python client for data.gouv.fr.
Official documentation is here: https://guides.data.gouv.fr/guide-data.gouv.fr/api/reference.
Current API version supported = "1".
Getting Started
from datagouv import DatagouvClient
client = DatagouvClient(MY_API_KEY)
# Get a dataset
dataset = client.datasets.get(my_dataset_id)
dataset_resources = dataset.get('resources')
# Upload a new resource from a file
client.datasets.post_resource_file(my_dataset_id, filename)
# Update a resource file
client.datasets.put_resource_file(my_dataset_id, filename, resource_id)
# Update a resource
client.datasets.put_resource(my_dataset_id, resource)
Download all resources to current directory
from datagouv import ResourcesDownloader
# Get a dataset: https://meteo.data.gouv.fr/datasets/656dab84db1bdf627a40eaae
dataset_id = "656dab84db1bdf627a40eaae"
# Instanciate ResourcesDownloader
downloader = ResourcesDownloader(dataset_id)
# Download to current directory
downloader.download()
Download only 'main' resources with "2024" in title
from datagouv import ResourcesDownloader
# Get a dataset: https://meteo.data.gouv.fr/datasets/656dab84db1bdf627a40eaae
dataset_id = "656dab84db1bdf627a40eaae"
# Instanciate ResourcesDownloader
downloader = ResourcesDownloader(dataset_id, resource_types=["main"] ,title_regex="2024")
# Download to 'output_dir' directory
downloader.download("./output_dir")
Development
poetry run start
poetry run black datagouv/
poetry run flake8
Build and Publish
Steps
poetry version # [patch, minor, major]
poetry install
# TODO: Update CHANGELOG
git commit -m "vX.X.X"
git tag vX.X.X
poetry build
poetry publish
git push --tags
git push
Test
poetry run pytest
Commands
poetry add pytest --group dev
poetry version
poetry version -s
poetry version [patch, minor, major]
poetry build
Config
# test-pypi
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi MY_TOKEN
poetry publish -r test-pypi
# pypi
poetry config pypi-token.pypi MY_TOKEN
poetry publish
Resources
Roadmap
- Handle /datasets routes
- Handle other routes
- /site
- /reuses
- /discussions
- /organizations
- /spatial
- /users
- /me
- /workers
- /tags
- /topics
- /posts
- /transfer
- /notifications
- /avatars
- /harvest
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
datagouv_python-0.1.5.tar.gz
(18.0 kB
view details)
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 datagouv_python-0.1.5.tar.gz.
File metadata
- Download URL: datagouv_python-0.1.5.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d446412e409d42f555402d27201f18215ab055a41f5e885e22587ad29db1b4e3
|
|
| MD5 |
f7a05fa11282a594e61639875d4b0176
|
|
| BLAKE2b-256 |
e573b243a78c206fbf1c1c01b1f0997b5de1e4d7a297f7ecd5ea253a0de7bbeb
|
File details
Details for the file datagouv_python-0.1.5-py3-none-any.whl.
File metadata
- Download URL: datagouv_python-0.1.5-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8db078aad1de13897eec503eeaad9d16f61e2ab12c1c01898c1330cd29f38a50
|
|
| MD5 |
0fed41a45e2dbe1eef324dcbce1470d5
|
|
| BLAKE2b-256 |
6aa238c1b2a3dea3244905cb3609516649096dc329b3ef5efd07aa28dee6ca43
|