Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rfleming71/pyapcsc
Python Client for APC Smart connect
https://github.com/rfleming71/pyapcsc
apc apc-smartconnect asyncio hacktoberfest home-assistant python
Last synced: about 1 month ago
JSON representation
Python Client for APC Smart connect
- Host: GitHub
- URL: https://github.com/rfleming71/pyapcsc
- Owner: rfleming71
- License: mit
- Created: 2022-09-13T23:22:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T00:05:57.000Z (over 2 years ago)
- Last Synced: 2024-11-14T09:12:04.868Z (about 2 months ago)
- Topics: apc, apc-smartconnect, asyncio, hacktoberfest, home-assistant, python
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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()
```