Skip to main content

Async Typed Python package for the Chemelex (nVent) RAYCHEM SENZ RestAPI

Project description

pysenz package

PyPI PyPI - Downloads PyPI - License

This repo is based on a fork from https://github.com/milanmeu/aiosenz

An async Python wrapper for the nVent (aka Chemelex) Raychem SENZ RestAPI.

Installation

pip install pysenz

OAuth2

This package offers an AbstractSENZAuth, where you should handle the OAuth2 tokens and provide a valid access token in get_access_token(). You can use SENZAuth if you don't want to handle the OAuth2 tokens yourself.

Grant type

SENZAuth uses the Authorization Code grant type. This requires a Client ID and Client Secret, more information is available in the RestAPI documentation.

Scopes

pysenz uses the restapi, openid, and offline_access scope, this is set as default in SENZAuth and should be set in the OAuth2 client if you are using the AbstractSENZAuth class.

Example

from asyncio import run
from pysenz import SENZAuth, SENZAPI
import httpx

async def main():
    async with httpx.AsyncClient() as httpx_client:
        senz_auth = SENZAuth(
            httpx_client,
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
            redirect_uri="http://localhost:8080/auth/callback",
        )
        uri, state = await senz_auth.get_authorization_url()
        print("Authorization URI: ", uri)
        authorization_response = input("The authorization response URL: ")
        await senz_auth.set_token_from_authorization_response(authorization_response)

        senz_api = SENZAPI(senz_auth)
        thermostats = await senz_api.get_thermostats()
        for thermostat in thermostats:
            print(f"{thermostat.name} temperature: {thermostat.current_temperatue}")
        await senz_auth.close()

run(main())

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

pysenz-1.0.2.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

pysenz-1.0.2-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file pysenz-1.0.2.tar.gz.

File metadata

  • Download URL: pysenz-1.0.2.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysenz-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d2be505744919911fce4bb390ac86379cfb8128edfd63a83ebc0cbc8cc5788e1
MD5 3b65273bb250c8c88d2705f5dbb40130
BLAKE2b-256 06dc1ee5d9f07698efabfede14e202c4325a2d8a8f21862bfaca52a1a0deaf2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysenz-1.0.2.tar.gz:

Publisher: ci.yml on nordicopen/pysenz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysenz-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pysenz-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysenz-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4accbff69b5be10526db4311b534a972daec5fd17c966b8b0fe5e7048a88ed46
MD5 7626fdef97dc063e12f46626faa3c824
BLAKE2b-256 259525fc5cbc1b92c86cbb1c83969b0bdadff181661af7f14b6a20488a389ac3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysenz-1.0.2-py3-none-any.whl:

Publisher: ci.yml on nordicopen/pysenz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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