File

class canvasapi.file.File(requester, attributes)
Parameters:
  • requester (canvasapi.requester.Requester) – The requester to pass HTTP requests through.

  • attributes (dict) – The JSON object to build this object with.

delete(**kwargs)

Delete this file.

Calls:

DELETE /api/v1/files/:id

Return type:

canvasapi.file.File

download(location)

Download the file to specified location.

Parameters:

location (str) – The path to download to.

get_contents(binary=False)

Download the contents of this file. Pass binary=True to return a bytes object instead of a str.

Return type:

str or bytes

update(**kwargs)

Update some settings on the specified file.

Calls:

PUT /api/v1/files/:id

Return type:

canvasapi.file.File