Authorizer

exception puddle.client.auth.authorizer.AuthError

Bases: Exception

Authentication error.

class puddle.client.auth.authorizer.Authorizer(server_address, request_hook=None, response_hook=None, api_key_id=None, api_secret_key=None)

Bases: object

PUDDLE_API_KEY_ID_ENV_VAR_NAME = 'PUDDLE_api_key_id'

Environment variable from which the api key id is read.

PUDDLE_API_SECRET_KEY_ENV_VAR_NAME = 'PUDDLE_api_secret_key'

Environment variable from which the api secret key is read.

headers()
Returns

Dict with all required headers, including auth header.

login()

Executes the login to Puddle.

Return type

LoginResponse

Returns

LoginResponse from backend.

logout()

Logs out from Puddle.

property server_address
Return type

str

Returns

Backend server address used by this Authorizer.

property token
Return type

Optional[str]

Returns

Puddle auth token, might be None.

property user
Return type

Optional[LoginUser]

Returns

Currently logged in user, might be None.