Low-level HTTP functions

In general there is little need to touch these unless you want to do custom low-level calls.

Helper module for hub_api & cloud_api

cozify.http.session[source]

Global session used for communications.

Type:requests.Session
cozify.http.get(call, *, token, headers=None, params=None, **kwargs)[source]

GET method for calling hub or cloud APIs.

Parameters:
  • call (str) – Full API URL.
  • token (str) – Either hub_token or cloud_token depending on target of call.
  • headers (dict) – Any additional headers to add to the call.
  • params (dict) – Any additional URL parameters to pass.
  • **remote (bool) – If call is to be local or remote (bounced via cloud).
  • **cloud_token (str) – Cloud authentication token. Only needed if remote = True.
cozify.http.post(call, *, token, headers=None, payload=None, params=None, **kwargs)[source]

POST method for calling hub our cloud APIs.

Parameters:
  • call (str) – Full API URL.
  • payload (str) – json string to push out as the payload.
  • token (str) – Either hub_token or cloud_token depending on target of call.
  • headers (dict) – Any additional headers to add to the call.
  • params (dict) – Any additional URL parameters to pass.
  • **remote (bool) – If call is to be local or remote (bounced via cloud).
  • **cloud_token (str) – Cloud authentication token. Only needed if remote = True.
cozify.http.put(call, payload, *, token, headers=None, params=None, **kwargs)[source]

PUT method for calling hub or cloud APIs.

Parameters:
  • call (str) – Full API URL.
  • payload (str) – json string to push out as the payload.
  • token (str) – Either hub_token or cloud_token depending on target of call.
  • headers (dict) – Any additional headers to add to the call.
  • params (dict) – Any additional URL parameters to pass.
  • **remote (bool) – If call is to be local or remote (bounced via cloud).
  • **cloud_token (str) – Cloud authentication token. Only needed if remote = True.