Uploader

class canvasapi.upload.Uploader(requester, url, file: Union[os.PathLike, str, io.IOBase, _io.FileIO], **kwargs)

Upload a file to Canvas.

Parameters:
request_upload_token(file)

Request an upload token.

Parameters:file – A file handler pointing to the file to upload.
Returns:True if the file uploaded successfully, False otherwise, and the JSON response from the API.
Return type:tuple
start()

Kick off uploading process. Handles open/closing file if a path is passed.

Calls:request_upload_token
Returns:True if the file uploaded successfully, False otherwise, and the JSON response from the API.
Return type:tuple
upload(response, file)

Upload the file.

Parameters:
  • response (dict) – The response from the upload request.
  • file – A file handler pointing to the file to upload.
Returns:

True if the file uploaded successfully, False otherwise, and the JSON response from the API.

Return type:

tuple