Skip to content

uhlive.auth

Authentication helpers

build_authentication_request

build_authentication_request(
    client_id: str, client_secret: str, user_id: str = "", user_pwd: str = ""
) -> Tuple[str, Dict[str, str]]

Build a couple (url, param dict) to be use in an HTTP POST request to get the API access_token.

Synchronous example using requests:

auth_url, auth_params = build_authentication_request(uhlive_client, uhlive_secret)
login = requests.post(auth_url, data=auth_params)
login.raise_for_status()
uhlive_token = login.json()["access_token"]