Skip to main content

Async client library for the Switch2 energy portal

Project description

python-switch2

Async Python client library for the Switch2 energy portal.

Installation

pip install switch2

Usage

import asyncio
from switch2 import Switch2ApiClient

async def main():
    async with Switch2ApiClient("you@example.com", "your-password") as client:
        data = await client.fetch_data()
        print(f"Customer: {data.customer.name}")
        if data.account_balance is not None:
            print(f"Balance: £{data.account_balance.balance}")
        for reading in data.readings:
            print(f"  {reading.date}: {reading.amount} {reading.unit}")
        for bill in data.bills:
            print(f"  {bill.date}: £{bill.amount}")
            detail = await client.fetch_bill_detail(bill)
            print(f"    invoice {detail.invoice_number}, total £{detail.total}")

asyncio.run(main())

License

Apache-2.0

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

switch2-0.1.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

switch2-0.1.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file switch2-0.1.3.tar.gz.

File metadata

  • Download URL: switch2-0.1.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for switch2-0.1.3.tar.gz
Algorithm Hash digest
SHA256 888412ad7d0f806ad1e410dd0aabaca3b6da2f239368db241bcd84d875250d15
MD5 184d2e286529e576c8b5d538e221aeba
BLAKE2b-256 10e38326826c5fea6d4a45bc1c054241c2678c28b56682bf43266e535d885272

See more details on using hashes here.

File details

Details for the file switch2-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: switch2-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for switch2-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6655a9645a8976474feffa21a7829075554920329ce7020709952bc50952557a
MD5 c28f09ce726c946529480f3f583ce7a6
BLAKE2b-256 be072106854b5da369baa731184eb51ac84743158c1efe02fb3e6494ba4a25f5

See more details on using hashes here.

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