Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(parser): use GITHUB_TOKEN for ZIP downloads if available (#1146)

Jelle Spijker8b4ffcb8c1b8
diff --git a/openviking/parse/parsers/code/code.py b/openviking/parse/parsers/code/code.py
index 91635e093..a9c1c7da0 100644
--- a/openviking/parse/parsers/code/code.py
+++ b/openviking/parse/parsers/code/code.py
@@ -371,7 +371,12 @@ class CodeRepositoryParser(BaseParser):
# 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)