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.1b1.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.1b1-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file pysenz-1.0.1b1.tar.gz.

File metadata

  • Download URL: pysenz-1.0.1b1.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.1b1.tar.gz
Algorithm Hash digest
SHA256 78d65b38879946b23d96e77699c85b25893f0b3106ac42c2bdae176e5e5ab499
MD5 9b3625d894b23df060a87c47cc0f90b6
BLAKE2b-256 58a1af87ace241df32eb6ffed8e4feba863e17e110d9e60f8b956cdf61fc5210

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysenz-1.0.1b1.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.1b1-py3-none-any.whl.

File metadata

  • Download URL: pysenz-1.0.1b1-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.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce73dd12c5286eeb5e676f3b93833091fa6e3b9c6991792d654679f51b5a606
MD5 e6899d585f7ed82675892464578834ed
BLAKE2b-256 6b9efc1d741e05f04a2abccc4bcb979ed191e976782f06753a8ed125d4e2f952

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysenz-1.0.1b1-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