Skip to content

Commit

Permalink
fix: checking status code to determine rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Aradhya-Tripathi committed Mar 28, 2022
1 parent bd105a6 commit dbb1904
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bench/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,14 @@ def clear_command_cache(bench_path="."):
print("Bench command cache doesn't exist in this folder!")


@lru_cache(maxsize=5)
def find_org(org_repo):
import requests

org_repo = org_repo[0]

for org in ["frappe", "erpnext"]:
res = requests.head(f"https://api.github.com/repos/{org}/{org_repo}")
if "message" in res.json():
if res.status_code == 400:
res = requests.head(f"https://github.com/{org}/{org_repo}")
if res.ok:
return org, org_repo
Expand Down

0 comments on commit dbb1904

Please sign in to comment.