Fetch data from VigiEau fr
Project description
VigiEauPy
Asynchronous Python client for the VigiEau API, the official French service for monitoring water use restrictions during drought periods.
Installation
pip install vigieaupy
Requirements
- Python >= 3.10
- aiohttp >= 3.8.1
Usage
import asyncio
from vigieaupy import Consommateur, Source, VigiEau, VigiEauException
async def main():
api = VigiEau()
try:
# Search for a commune by name or postal code
communes = await api.async_get_cog(name="Nantes")
# or: communes = await api.async_get_cog(codeZip=44000)
# Fetch active water restrictions
restrictions = await api.async_get_data(
codeInsee=communes[0]["code"],
source=Source.AEP,
consommateur=Consommateur.particulier,
)
for restriction in restrictions:
print(restriction)
except VigiEauException as err:
print(f"Error: {err}")
finally:
await api.async_close()
asyncio.run(main())
API
VigiEau(session=None, timeout=120)
Main client class. Optionally accepts an existing aiohttp.ClientSession and a timeout in seconds.
async_get_cog(codeZip=None, name=None)
Search for communes using the French government API (geo.api.gouv.fr).
| Parameter | Type | Description |
|---|---|---|
codeZip |
int |
5-digit postal code |
name |
str |
Commune name (3 characters minimum) |
Returns a list of matching communes.
async_get_data(codeInsee, source=None, consommateur=None)
Fetch active water restrictions for a commune.
| Parameter | Type | Description |
|---|---|---|
codeInsee |
str |
INSEE code of the commune |
source |
Source |
Water resource type (optional) |
consommateur |
Consommateur |
Consumer profile (optional) |
Enum Source
| Value | Description |
|---|---|
Source.AEP |
Tap water |
Source.SUP |
Rivers and streams |
Source.SOU |
Groundwater (wells or boreholes) |
Enum Consommateur
| Value | Description |
|---|---|
Consommateur.particulier |
Individual |
Consommateur.exploitation |
Agricultural operation |
Consommateur.entreprise |
Professional |
Consommateur.collectivite |
Local authority |
Exceptions
| Exception | Description |
|---|---|
VigiEauException |
Base client exception |
HttpRequestError |
API communication error |
TimeoutExceededError |
Request timed out |
RequestException |
HTTP error returned by the API |
License
GPL-3.0-or-later — see the LICENSE file.
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 vigieaupy-1.1.0.tar.gz.
File metadata
- Download URL: vigieaupy-1.1.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f33bd82b5ebce135302c2ec42cd752f6cacf663d9f533a063c03690348470b0
|
|
| MD5 |
dca1c258bbfc74dac1c5ccb553d06022
|
|
| BLAKE2b-256 |
e7a086c97331e01e2c7771ed731924b3a724a44c99fb43c59e95e9dde506998f
|
Provenance
The following attestation bundles were made for vigieaupy-1.1.0.tar.gz:
Publisher:
python-publish.yml on cyr-ius/vigieaupy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vigieaupy-1.1.0.tar.gz -
Subject digest:
5f33bd82b5ebce135302c2ec42cd752f6cacf663d9f533a063c03690348470b0 - Sigstore transparency entry: 1745605102
- Sigstore integration time:
-
Permalink:
cyr-ius/vigieaupy@26ccf39624417d86908c2968e0b9d0eece20f3ef -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/cyr-ius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26ccf39624417d86908c2968e0b9d0eece20f3ef -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vigieaupy-1.1.0-py3-none-any.whl.
File metadata
- Download URL: vigieaupy-1.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee43dd88d018773ae962e6b2e2b9bf4db97c90363153e4bdd2c785e1b73e137e
|
|
| MD5 |
82ad20b134a00e3e6d1277ca9a81f526
|
|
| BLAKE2b-256 |
c762a546b9b5ff1d80eaa01261368aaad7e0bad3aacabbfe79965b83314b462b
|
Provenance
The following attestation bundles were made for vigieaupy-1.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on cyr-ius/vigieaupy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vigieaupy-1.1.0-py3-none-any.whl -
Subject digest:
ee43dd88d018773ae962e6b2e2b9bf4db97c90363153e4bdd2c785e1b73e137e - Sigstore transparency entry: 1745605202
- Sigstore integration time:
-
Permalink:
cyr-ius/vigieaupy@26ccf39624417d86908c2968e0b9d0eece20f3ef -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/cyr-ius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26ccf39624417d86908c2968e0b9d0eece20f3ef -
Trigger Event:
workflow_dispatch
-
Statement type: