Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion openviking/parse/parsers/code/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,12 @@ async def _github_zip_download(

# Download (blocking HTTP; run in thread pool to avoid stalling event loop).
def _download() -> None:
req = urllib.request.Request(zip_url, headers={"User-Agent": "OpenViking"})
headers = {"User-Agent": "OpenViking"}
github_token = os.environ.get("GITHUB_TOKEN")
if github_token:
headers["Authorization"] = f"token {github_token}"

req = urllib.request.Request(zip_url, headers=headers)
with urllib.request.urlopen(req, timeout=1800) as resp, open(zip_path, "wb") as f:
shutil.copyfileobj(resp, f)

Expand Down