Skip to content

Commit c1db02a

Browse files
committed
Fixes ucfopen#687 - auth conflict
Roughly April 10th, 2025, something changed about the way auth was handled for files. By including the auth headers in GET requests for files, a session cookie was being set that seemed to cause 401s for any file requests. In essence, one bad request meant that you couldn't recover unless you specifically cleared those cookies out of the session. Here we avoid that problem entirely by simply not sending auth headers when requesting attachment downloads. More discussion here: ucfopen#687
1 parent f30082c commit c1db02a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

canvasapi/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def download(self, location):
2727
:param location: The path to download to.
2828
:type location: str
2929
"""
30-
response = self._requester.request("GET", _url=self.url)
30+
response = self._requester.request("GET", _url=self.url, use_auth=False)
3131

3232
with open(location, "wb") as file_out:
3333
file_out.write(response.content)
@@ -39,7 +39,7 @@ def get_contents(self, binary=False):
3939
4040
:rtype: str or bytes
4141
"""
42-
response = self._requester.request("GET", _url=self.url)
42+
response = self._requester.request("GET", _url=self.url, use_auth=False)
4343
if binary:
4444
return response.content
4545
else:

0 commit comments

Comments
 (0)