Python SDK to communicate with ANA's HidroWeb API for hydrological and pluviometric data
Project description
hidrowebsdk/README.md
HidroWebSDK
⚠️ Aviso: Este projeto está em desenvolvimento ativo e está em estágio alfa. As APIs podem mudar sem aviso prévio.
HidroWebSDK é um SDK Python para simplificar e automatizar o download de dados hidrológicos das estações de monitoramento da Agência Nacional de Águas (ANA) via sua API oficial (HidroWeb).
Índice
Recursos
- Solicitações HTTP assíncronas usando
httpxpara melhor desempenho - Atualização automática de token OAuth
- Métodos fáceis de usar para buscar dados de bacias, entidades e estações
- Retorna dados como DataFrames do Pandas para fácil análise
- Conjunto abrangente de testes
Instalação
Instale o HidroWebSDK usando pip:
pip install hidrowebsdk
Para desenvolvimento, clone o repositório e instale com dependências de desenvolvimento:
git clone https://github.com/yourusername/hidrowebsdk.git
cd hidrowebsdk
pip install -e ".[dev]"
Uso
Uso Básico
import asyncio
from hidrowebsdk import Client
async def main():
# Inicialize o cliente
client = Client(user="your_user", password="your_password")
# Autentique (opcional, feito automaticamente na primeira solicitação)
await client.authenticate()
# Busque todas as bacias
basins = await client.bacias()
print(basins.head())
# Busque entidades com filtros
from datetime import datetime
entities = await client.entidades(
last_update_start=datetime(2023, 1, 1),
last_update_end=datetime(2023, 12, 31)
)
print(entities.head())
# Busque estações de um estado específico
stations = await client.estacoes(state="SP")
print(stations.head())
# Feche o cliente
await client.close()
# Execute a função assíncrona
asyncio.run(main())
Variáveis de Ambiente
Você pode definir suas credenciais usando variáveis de ambiente:
export HIDROWEB_USER="your_user"
export HIDROWEB_PASSWORD="your_password"
Então, inicialize o cliente sem parâmetros:
client = Client()
Contribuição
Contribuições são bem-vindas! Sinta-se à vontade para enviar um Pull Request.
- Fork o repositório
- Crie sua branch de recurso (
git checkout -b feature/AmazingFeature) - Commit suas mudanças (
git commit -m 'Add some AmazingFeature') - Push para a branch (
git push origin feature/AmazingFeature) - Abra um Pull Request
Testes
Execute o conjunto de testes:
pytest
Licença
Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.
Agradecimentos
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 hidrowebsdk-0.2.1.tar.gz.
File metadata
- Download URL: hidrowebsdk-0.2.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
595d434c9fdfa6e4d77f7b092d47c72b73bb1b3afac6fa213faf5272b5530584
|
|
| MD5 |
ffbad51efc412944d31a930f5b7a87a4
|
|
| BLAKE2b-256 |
0c58f51928e28dedfc1062fd9fa14d0cd819d12d7879cd937f43178645173e8d
|
Provenance
The following attestation bundles were made for hidrowebsdk-0.2.1.tar.gz:
Publisher:
pypi.yml on NVXtech/hidrowebsdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hidrowebsdk-0.2.1.tar.gz -
Subject digest:
595d434c9fdfa6e4d77f7b092d47c72b73bb1b3afac6fa213faf5272b5530584 - Sigstore transparency entry: 768727453
- Sigstore integration time:
-
Permalink:
NVXtech/hidrowebsdk@2e97fc1d19f766fab4f3f178cd5d7efa6993b432 -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/NVXtech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2e97fc1d19f766fab4f3f178cd5d7efa6993b432 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hidrowebsdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: hidrowebsdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.5 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 |
c98ae1823d76f245f59690bb3efc0bcda0acb0603a11eac5a43a5375205034b1
|
|
| MD5 |
4188af3e9290e1720f3f8763d2b37594
|
|
| BLAKE2b-256 |
5720cb6adfaceed787523aff773ba1f35161eae7f4e24e10fe358b095a274fc8
|
Provenance
The following attestation bundles were made for hidrowebsdk-0.2.1-py3-none-any.whl:
Publisher:
pypi.yml on NVXtech/hidrowebsdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hidrowebsdk-0.2.1-py3-none-any.whl -
Subject digest:
c98ae1823d76f245f59690bb3efc0bcda0acb0603a11eac5a43a5375205034b1 - Sigstore transparency entry: 768727458
- Sigstore integration time:
-
Permalink:
NVXtech/hidrowebsdk@2e97fc1d19f766fab4f3f178cd5d7efa6993b432 -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/NVXtech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2e97fc1d19f766fab4f3f178cd5d7efa6993b432 -
Trigger Event:
release
-
Statement type: