Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiosenz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiosenz

Async Typed Python package for the nVent RAYCHEM SENZ RestAPI

  • 1.0.0
  • PyPI
  • Socket score

Maintainers
1

aioSENZ package

PyPI PyPI - Downloads PyPI - License

An async Python wrapper for the nVent Raychem SENZ RestAPI.

Installation

pip install aiosenz

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

AioSENZ uses the restapi 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. The OpenID (openid) and OpenID Profile (profile) scopes are not supported, because nVent recommends to use the RestAPI Account instead.

Example

from asyncio import run
from aiosenz 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())

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc