-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
The Release Asset download feature added in #3060 is currently broken for public repositories.
Steps to reproduce:
from github import Github
github = Github()
public_repo = github.get_repo("stellarcarbon/sorocarbon")
latest_release = public_repo.get_latest_release()
asset = latest_release.assets[0]
asset.download_asset(f"/tmp/{asset.name}")It fails on:
Line 1179 in b4092b5
| del requestHeaders["Authorization"] |
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alex/.pyenv/versions/stellarcarbon-3.12/lib/python3.12/site-packages/github/GitReleaseAsset.py", line 163, in download_asset
self._requester.getFile(self.url, path=path, chunk_size=chunk_size)
File "/home/alex/.pyenv/versions/stellarcarbon-3.12/lib/python3.12/site-packages/github/Requester.py", line 901, in getFile
_, _, stream_chunk_iterator = self.getStream(url, parameters, headers, cnx, chunk_size=chunk_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/.pyenv/versions/stellarcarbon-3.12/lib/python3.12/site-packages/github/Requester.py", line 928, in getStream
status, responseHeaders, output = self.__requestEncode(
^^^^^^^^^^^^^^^^^^^^^
File "/home/alex/.pyenv/versions/stellarcarbon-3.12/lib/python3.12/site-packages/github/Requester.py", line 1098, in __requestEncode
status, responseHeaders, output = self.__requestRaw(
^^^^^^^^^^^^^^^^^^
File "/home/alex/.pyenv/versions/stellarcarbon-3.12/lib/python3.12/site-packages/github/Requester.py", line 1186, in __requestRaw
del requestHeaders["Authorization"]
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'Authorization'
Apparently, the assumption that an Authorization header will be present is incorrect. I don't know which (if any) other features are impacted by this assumption. Could we simply pop the key, or check for its presence before deletion?
alecglen
Metadata
Metadata
Assignees
Labels
No labels