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
Release files for hidrowebsdk 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hidrowebsdk-0.2.1.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hidrowebsdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.4 kB
Release files / hidrowebsdk-0.2.1.tar.gz
| Download URL | hidrowebsdk-0.2.1.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
595d434c9fdfa6e4d77f7b092d47c72b73bb1b3afac6fa213faf5272b5530584
|
|
BLAKE2b-256 checksum How to use checksums |
0c58f51928e28dedfc1062fd9fa14d0cd819d12d7879cd937f43178645173e8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 17, 2025.
Transparency logRelease files / hidrowebsdk-0.2.1-py3-none-any.whl
| Download URL | hidrowebsdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c98ae1823d76f245f59690bb3efc0bcda0acb0603a11eac5a43a5375205034b1
|
|
BLAKE2b-256 checksum How to use checksums |
5720cb6adfaceed787523aff773ba1f35161eae7f4e24e10fe358b095a274fc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 17, 2025.
Transparency log