Python library to retrieve information from "Aguas de Gaia" portal
Project description
Aguas de Gaia API
Installation
$ pip install aguasgaia
Usage
import asyncio
import aiohttp
from aguasgaia import AguasGaia
async def main():
session = aiohttp.ClientSession()
aguas = AguasGaia(session, "<USERNAME>", "<PASSWORD>")
print("LOGIN: ", await aguas.login())
print("SUBSCRIPTIONS:\n{0}".format(await aguas.get_subscriptions()))
inv = await aguas.get_last_invoice()
print("INVOICE: {0}\n{1}".format(inv.invoice_value, inv.invoice_attributes))
consumption = await aguas.get_last_consumption()
print("CONSUMPTION: {0}\n{1}".format(consumption.consumption_value, consumption.consumption_attributes))
await session.close()
if __name__ == "__main__":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
Tests
Make sure pytest asyncio is installed
$ pip install pytest-asyncio
Execute the tests
$ pytest tests/
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
aguasgaia-0.0.21.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file aguasgaia-0.0.21.tar.gz
.
File metadata
- Download URL: aguasgaia-0.0.21.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aef82004b0b94eebf5ee0663848b8f60c6600d4ce0c150db4cbdbcfa35fb434 |
|
MD5 | 600086acaaf937391185197620fb2ca2 |
|
BLAKE2b-256 | 7388458b39a29c32870e4962a541b5b0a6b21921e9edb1542a777139d0d0ca95 |
File details
Details for the file aguasgaia-0.0.21-py3-none-any.whl
.
File metadata
- Download URL: aguasgaia-0.0.21-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3ca093edfd3a92cb5c26aef90c1b9711dfd89496022f25ad934b25d73bcbd35 |
|
MD5 | 2d1b783c586d96f8a243ee96ed956753 |
|
BLAKE2b-256 | 896751d44f78cdc3b65992be1c73cc47033fabe16b9249a872b9c4ae61d2753e |