Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I'm trying to download a file from Canvas using Python. When I use the API to fetch the file by ID I get a response that contains a URL like the following: /files/{id}/download?download_frd=1. However I can't seem to download this. I've tried using requests.get(url,allow_redirects=True) but I just get redirected to the default login page for my institution. Any help would be appreciated, thanks!
Hi @LucasRothman,
I believe the url field returned by the API should include a "verifier" querystring at the end that basically authenticates the download so you don't get directed to your login page. See the Files API page for examples of this. Without the verifier, you'd need to be authenticated to Canvas for the download to work (and that's why you're getting redirected to the login page).
-Chris
I'm assuming you can download the file via URL in the browser when you are authenticated. Check the headers on the request in the browser (should be HTTP GET) dev tools, see if oauth, etc are present.
To participate in the Instructure Community, you need to sign up or log in:
Sign In