Requester

class canvasapi.requester.Requester(base_url, access_token)

Responsible for handling HTTP requests.

Parameters:
  • base_url (str) – The base URL of the Canvas instance’s API.
  • access_token (str) – The API key to authenticate requests with.
request(method, endpoint=None, headers=None, use_auth=True, _url=None, _kwargs=None, json=False, **kwargs)

Make a request to the Canvas API and return the response.

Parameters:
  • method (str) – The HTTP method for the request.
  • endpoint (str) – The endpoint to call.
  • headers (dict) – Optional HTTP headers to be sent with the request.
  • use_auth (bool) – Optional flag to remove the authentication header from the request.
  • _url (str) – Optional argument to send a request to a URL outside of the Canvas API. If this is selected and an endpoint is provided, the endpoint will be ignored and only the _url argument will be used.
  • _kwargs (list) – A list of 2-tuples representing processed keyword arguments to be sent to Canvas as params or data.
  • json (bool) – Whether or not to treat the data as json instead of form data. currently only the POST request of GraphQL is using this parameter. For all other methods it’s just passed and ignored.
Return type:

requests.Response