Skip to main content

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

Release files for switch2 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for switch2 0.1.3
File Size Uploaded
switch2-0.1.3.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for switch2 0.1.3
File Interpreter ABI Platform
switch2-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / switch2-0.1.3.tar.gz

Download URL switch2-0.1.3.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
888412ad7d0f806ad1e410dd0aabaca3b6da2f239368db241bcd84d875250d15
BLAKE2b-256 checksum
How to use checksums
10e38326826c5fea6d4a45bc1c054241c2678c28b56682bf43266e535d885272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / switch2-0.1.3-py3-none-any.whl

Download URL switch2-0.1.3-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6655a9645a8976474feffa21a7829075554920329ce7020709952bc50952557a
BLAKE2b-256 checksum
How to use checksums
be072106854b5da369baa731184eb51ac84743158c1efe02fb3e6494ba4a25f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page