A python wrapper around Nibe Uplink REST API
Project description
Module
The module is an asyncio driven interface to nibe uplink public API. It is throttled to one http request every 4 seconds so try to make the most of your requests by batching requests.
Status
Example
def token_read():
return None
def token_write(token):
pass
async def run():
async with nibeuplink.Uplink(client_id = 'XXX',
client_secret = 'YYY',
redirect_uri = 'ZZZ',
access_data = token_read(),
access_data_write = token_write,
scope = 'READSYSTEM') as uplink:
if not uplink.access_data:
auth_uri = uplink.get_authorize_url()
print(auth_uri)
result = input('Enter full redirect url: ')
await uplink.get_access_token(uplink.get_code_from_url(result))
# Request all systems
print(uplink.get_systems())
# Request data for specific system
print(uplink.get_system(12345))
# Request data for parameters. Note request them in paralell using gather semantics
# that way, the module with batch up the requests into a single request to api
print(await asyncio.gather(uplink.get_parameter(12345, 11111),
uplink.get_parameter(12345, 22222)))
loop = asyncio.get_event_loop()
loop.run_until_complete (run())
Console
The module contains a commandline utility to test and request data from Nibe Uplink called nibeuplink, it will store token information in a file in the current directory called nibeuplink.json
Example
Help for utility
nibeuplink -h
Request all systems
nibeuplink --client_id 'XXX' --client_secret 'YYY' --redirect_uri 'ZZZ'
Request data for specific system
nibeuplink --client_id 'XXX' --client_secret 'YYY' --redirect_uri 'ZZZ' --system 12345
Request data for parameters
nibeuplink --client_id 'XXX' --client_secret 'YYY' --redirect_uri 'ZZZ' --system 12345 --parameter 11111 22222
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nibeuplink-1.2.1.tar.gz
(13.6 kB
view details)
Built Distribution
File details
Details for the file nibeuplink-1.2.1.tar.gz
.
File metadata
- Download URL: nibeuplink-1.2.1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 322f24a7527237742bae43501ee8864912bf3a869568648160009f553f93bb80 |
|
MD5 | 733c727e82da306949a00e8bf239b9b7 |
|
BLAKE2b-256 | 2c97d92df98c6c406d82cef60aa9dee9b1f2630fafdad26409e78b931cfdcf4b |
File details
Details for the file nibeuplink-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: nibeuplink-1.2.1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81065afa547ca0ab0b02862dac60777bdfa6faa44e2d45c62c434b47baf054e3 |
|
MD5 | 8f0c451cddfd636d5febc6a264a011ea |
|
BLAKE2b-256 | 812bbd36df796092dad71832a1cb9d537689c3e49ee1b1f72fcb3f8c855e2b45 |