Skip to main content

Asynchronous Python API For Taipit Cloud Meters

Project description

aioTaipit

CI PyPI

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


Download files

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

Source Distribution

aiotaipit-3.0.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

aiotaipit-3.0.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

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

Hashes for aiotaipit-3.0.0.tar.gz
Algorithm Hash digest
SHA256 7d4c6d2193415d6e7fbcb3b14e1587e795411c4eb39f424037699b8acd90627b
MD5 a86371d246429ea0e2a69cd3069be1b3
BLAKE2b-256 b57dcdc0c742660bef62582e52731f1c7de194df69325d9a1ab4c02cafdebddb

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotaipit-3.0.0.tar.gz:

Publisher: publish.yml on lizardsystems/aiotaipit

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

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

Hashes for aiotaipit-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec61c3ffb076758957672264a5c50abfd72d70f0d5dcd9f556766e62735ab4a6
MD5 8fed056ab703fc8bf7b9c2b34dcea5fe
BLAKE2b-256 f357c5f897a0a1066f700382a0ca86f11b7be09227e26a43c32662da431c1b0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotaipit-3.0.0-py3-none-any.whl:

Publisher: publish.yml on lizardsystems/aiotaipit

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