mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-14 14:12:44 +00:00
Merge pull request #58531 from NousResearch/salvage/3033-contents-api-retry
fix(skills): retry rate-limited Contents API directory listings (salvage #3033)
This commit is contained in:
commit
d51657c0c6
1 changed files with 7 additions and 6 deletions
|
|
@ -909,12 +909,13 @@ class GitHubSource(SkillSource):
|
|||
def _download_directory_recursive(self, repo: str, path: str) -> Dict[str, str]:
|
||||
"""Recursively download via Contents API (fallback)."""
|
||||
url = f"https://api.github.com/repos/{repo}/contents/{path.rstrip('/')}"
|
||||
try:
|
||||
resp = httpx.get(url, headers=self.auth.get_headers(), timeout=15, follow_redirects=True)
|
||||
if resp.status_code != 200:
|
||||
logger.debug("Contents API returned %d for %s/%s", resp.status_code, repo, path)
|
||||
return {}
|
||||
except httpx.HTTPError:
|
||||
# Route through _github_get so directory listing gets the same
|
||||
# 429/403-rate-limit retry + backoff as file fetches (#3033).
|
||||
resp = self._github_get(url)
|
||||
if resp is None:
|
||||
return {}
|
||||
if resp.status_code != 200:
|
||||
logger.debug("Contents API returned %d for %s/%s", resp.status_code, repo, path)
|
||||
return {}
|
||||
|
||||
entries = resp.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue