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.0.tar.gz (17.7 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.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file hidrowebsdk-0.2.0.tar.gz.

File metadata

  • Download URL: hidrowebsdk-0.2.0.tar.gz
  • Upload date:
  • Size: 17.7 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.0.tar.gz
Algorithm Hash digest
SHA256 8b310fa70d76ce82e547de41fe34bfc61bec9505c9632cb7ebccfb785bf410f2
MD5 dabc675fab80301d2af904a436a1f7d5
BLAKE2b-256 d1a82d6d1e9f269bd0253b391af0918e07af99d0890b3879e58e0bb8a9334b4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hidrowebsdk-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: hidrowebsdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96340c2e16b6d93f3863f530afe3b2d90ded3696353b0616bdfc67a74d48f670
MD5 9a8a9b324748c98650ce6b5be0084512
BLAKE2b-256 b62c3ea33344bfefaab9cfbc1fa024bfc6d91e9bc6310dfc4016d21a2cbc3b3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hidrowebsdk-0.2.0-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