Requester

class fabman.requester.Requester(base_url: str, access_token: str)

Main class responsible for handling all http requests to the API. Based on canvasapi.requester.Requester found at https://github.com/ucfopen/canvasapi/blob/develop/canvasapi/requester.py

Parameters:
  • base_url (str) – The base URL of the Fabman instance’s API.

  • access_token (str) – The API key to authenticate requests with.

request(method: str, endpoint: str | None = None, headers: dict | None = None, use_auth: bool | None = True, _url: str | None = None, _kwargs: dict | None = None, json: bool | None = False, **kwargs) Response

Main method for handling requests to the API. Should never be called directly except for testing or from the Fabman class.

Parameters:
  • method (str) – The HTTP method to use for the request.

  • endpoint (str) – The API endpoint to call.

  • headers (dict) – HTTP headers to send with the request.

  • use_auth (bool) – Whether or not to include the access token in the request.

  • _url (str) – The full URL to use for the request. This overrides the base_url and endpoint.

  • _kwargs (dict) – Keyword arguments from the calling argument. These are morphed into the params or body of the request depending on method.

  • json (bool) – Whether or not to send the data as JSON.

Returns:

The response object if the call was successful

Return type:

requests.Response