mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
handle 302 responses in get_dir_contents requests
This commit is contained in:
committed by
Vincent Jacques
parent
f62f384bc6
commit
5e6adc580d
@@ -891,6 +891,16 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
|
||||
# Handle 302 redirect response
|
||||
if headers.get('status') == '302 Found' and headers.get('location'):
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
headers['location'],
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
|
||||
return [
|
||||
github.ContentFile.ContentFile(self._requester, attributes, completed=(attributes["type"] != "file")) # Lazy completion only makes sense for files. See discussion here: https://github.com/jacquev6/PyGithub/issues/140#issuecomment-13481130
|
||||
for attributes in data
|
||||
|
||||
Reference in New Issue
Block a user