MCPcopy Create free account
hub / github.com/JiriRichter/WRFDomainWizard / github_get

Function github_get

utils/github_utils.py:19–33  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

17 time.sleep(sleep_seconds)
18
19def github_get(url):
20 attempt = 1
21 while attempt <= 3:
22 response = requests.get(url)
23 print("Requesting {0} -> {1}".format(url, response.status_code))
24 if response.ok:
25 return response
26 ratelimit_remaining = response.headers.get("x-ratelimit-remaining")
27 if ratelimit_remaining == "0":
28 ratelimit_reset = response.headers.get("x-ratelimit-reset")
29 sleep_until(int(ratelimit_reset) + 1)
30 attempt += 1
31 else:
32 raise RuntimeError("Request failed")
33 raise RuntimeError("Request failed after {0} attempts".format(attempt))
34
35wrf_model_url = "https://api.github.com/repos/wrf-model/WRF/git/trees/master?recursive=1"
36def get_git_trees():

Calls 2

sleep_untilFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected