Asynchronous Python API For Taipit Cloud Meters
Project description
aioTaipit
Asynchronous Python API for Taipit cloud meters.
Installation
Use pip to install the library:
pip install aiotaipit
Usage
import asyncio
from pprint import pprint
import aiohttp
from aiotaipit import SimpleTaipitAuth, TaipitApi
async def main(username: str, password: str) -> None:
"""Create the aiohttp session and run the example."""
async with aiohttp.ClientSession() as session:
auth = SimpleTaipitAuth(username, password, session)
api = TaipitApi(auth)
meters = await api.async_get_meters()
pprint(meters)
if __name__ == "__main__":
_username = "<YOUR_USER_NAME>"
_password = "<YOUR_PASSWORD>"
asyncio.run(main(_username, _password))
The SimpleTaipitAuth client also accepts custom client ID and secret (this can be found by sniffing the client).
Exceptions
All exceptions inherit from TaipitError:
| Exception | Description |
|---|---|
TaipitApiError |
Non-auth HTTP errors (server errors, unexpected status codes) |
TaipitAuthError |
Base class for authentication errors |
TaipitAuthInvalidGrant |
Invalid username/password combination |
TaipitAuthInvalidClient |
Invalid OAuth client credentials |
TaipitTokenError |
Base class for token errors |
TaipitInvalidTokenResponse |
Token response missing required fields |
TaipitTokenAcquireFailed |
Failed to acquire a new token |
TaipitTokenRefreshFailed |
Failed to refresh the token |
CLI
# Show all meters (guest account)
python -m aiotaipit
# Show meters for a specific user
python -m aiotaipit -u user@example.com -p password
# Show meter info
python -m aiotaipit --info 12345
# Show readings
python -m aiotaipit --readings 12345
# Show settings
python -m aiotaipit --settings
# Show warnings
python -m aiotaipit --warnings
Timeouts
aiotaipit does not specify any timeouts for any requests. You will need to specify them in your own code. We recommend the timeout from asyncio package:
import asyncio
with asyncio.timeout(10):
all_readings = await api.async_get_meters()
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 aiotaipit-3.0.0.tar.gz.
File metadata
- Download URL: aiotaipit-3.0.0.tar.gz
- Upload date:
- Size: 14.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 |
7d4c6d2193415d6e7fbcb3b14e1587e795411c4eb39f424037699b8acd90627b
|
|
| MD5 |
a86371d246429ea0e2a69cd3069be1b3
|
|
| BLAKE2b-256 |
b57dcdc0c742660bef62582e52731f1c7de194df69325d9a1ab4c02cafdebddb
|
Provenance
The following attestation bundles were made for aiotaipit-3.0.0.tar.gz:
Publisher:
publish.yml on lizardsystems/aiotaipit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotaipit-3.0.0.tar.gz -
Subject digest:
7d4c6d2193415d6e7fbcb3b14e1587e795411c4eb39f424037699b8acd90627b - Sigstore transparency entry: 962902348
- Sigstore integration time:
-
Permalink:
lizardsystems/aiotaipit@0372f5a46b34a74002cac362a326abbe7dd62598 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/lizardsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0372f5a46b34a74002cac362a326abbe7dd62598 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiotaipit-3.0.0-py3-none-any.whl.
File metadata
- Download URL: aiotaipit-3.0.0-py3-none-any.whl
- Upload date:
- Size: 12.1 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 |
ec61c3ffb076758957672264a5c50abfd72d70f0d5dcd9f556766e62735ab4a6
|
|
| MD5 |
8fed056ab703fc8bf7b9c2b34dcea5fe
|
|
| BLAKE2b-256 |
f357c5f897a0a1066f700382a0ca86f11b7be09227e26a43c32662da431c1b0a
|
Provenance
The following attestation bundles were made for aiotaipit-3.0.0-py3-none-any.whl:
Publisher:
publish.yml on lizardsystems/aiotaipit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiotaipit-3.0.0-py3-none-any.whl -
Subject digest:
ec61c3ffb076758957672264a5c50abfd72d70f0d5dcd9f556766e62735ab4a6 - Sigstore transparency entry: 962902350
- Sigstore integration time:
-
Permalink:
lizardsystems/aiotaipit@0372f5a46b34a74002cac362a326abbe7dd62598 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/lizardsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0372f5a46b34a74002cac362a326abbe7dd62598 -
Trigger Event:
release
-
Statement type: