Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Sep 21, 2024
1 parent b320ce7 commit 8492bba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions olah/utils/repo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ async def get_newest_commit_hf(
return await get_newest_commit_hf_offline(app, repo_type, org, repo)
try:
async with httpx.AsyncClient() as client:
response = await client.get(url, headers={"authorization": authorization}, timeout=WORKER_API_TIMEOUT)
headers = {}
if authorization is not None:
headers["authorization"] = authorization
response = await client.get(url, headers=headers, timeout=WORKER_API_TIMEOUT)
if response.status_code != 200:
return await get_newest_commit_hf_offline(app, repo_type, org, repo)
obj = json.loads(response.text)
return obj.get("sha", None)
except:
except httpx.TimeoutException as e:
return await get_newest_commit_hf_offline(app, repo_type, org, repo)


Expand Down

0 comments on commit 8492bba

Please sign in to comment.