Skip to main content

Python SDK to communicate with ANA's HidroWeb API for hydrological and pluviometric data

Project description

hidrowebsdk/README.md

HidroWebSDK

PyPI version License: MIT Documentation

⚠️ 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 httpx para 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.

  1. Fork o repositório
  2. Crie sua branch de recurso (git checkout -b feature/AmazingFeature)
  3. Commit suas mudanças (git commit -m 'Add some AmazingFeature')
  4. Push para a branch (git push origin feature/AmazingFeature)
  5. 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

  • Agência Nacional de Águas (ANA) por fornecer a API HidroWeb
  • Construído com httpx para solicitações HTTP assíncronas
  • Construído com pandas para manipulação de dados
  • Construído com pytest para testes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hidrowebsdk-0.2.1.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hidrowebsdk-0.2.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

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

Hashes for hidrowebsdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 595d434c9fdfa6e4d77f7b092d47c72b73bb1b3afac6fa213faf5272b5530584
MD5 ffbad51efc412944d31a930f5b7a87a4
BLAKE2b-256 0c58f51928e28dedfc1062fd9fa14d0cd819d12d7879cd937f43178645173e8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hidrowebsdk-0.2.1.tar.gz:

Publisher: pypi.yml on NVXtech/hidrowebsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for hidrowebsdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c98ae1823d76f245f59690bb3efc0bcda0acb0603a11eac5a43a5375205034b1
MD5 4188af3e9290e1720f3f8763d2b37594
BLAKE2b-256 5720cb6adfaceed787523aff773ba1f35161eae7f4e24e10fe358b095a274fc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for hidrowebsdk-0.2.1-py3-none-any.whl:

Publisher: pypi.yml on NVXtech/hidrowebsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page