pyapcsc

An asynchronous Python library for communicating with the APC Smart Connect API


Keywords
apc, smartconnect, homeassistant, apc-smartconnect, asyncio, hacktoberfest, home-assistant, python
License
MIT
Install
pip install pyapcsc==0.1.8

Documentation

pyapcsc

Python Client for APC Smart connect

Usage

The library offers two class for interacting with the API.

API

Provides direct access to the API. Return types are the deserialized json objects.

async with aiohttp.ClientSession() as websession:
    websession._default_headers = MappingProxyType({})  # type: ignore
    client = pyapcsc.ApcSmartConnectApi(websession)
    await client.login("username", "password")
    gateways = await client.gateways()
    await websession.close()

Client

The client class offers a typed abstraction over the API. Also the client will handle reauthenticating when the existing cookie expires.

async with aiohttp.ClientSession() as websession:
    websession._default_headers = MappingProxyType({})  # type: ignore
    client = pyapcsc.ApcSmartConnectClient(websession)
    await client.login("username", "password")
    gateways = await client.gateways()
    await websession.close()