Raise exception if GET request returned an unsuccessful status code

This commit is contained in:
Nicola Soranzo
2022-04-04 12:40:16 +01:00
parent bad8ecbda2
commit 58d7e3cd96
@@ -145,8 +145,9 @@ class GitHubSearch():
Takes search_string variable and return results from the bioconda-recipes github repository in JSON format
"""
response = requests.get(
"https://api.github.com/search/code?q=%s+in:path+repo:bioconda/bioconda-recipes+path:recipes" % search_string, timeout=MULLED_SOCKET_TIMEOUT).json()
return response
f"https://api.github.com/search/code?q={search_string}+in:path+repo:bioconda/bioconda-recipes+path:recipes", timeout=MULLED_SOCKET_TIMEOUT)
response.raise_for_status()
return response.json()
def process_json(self, json, search_string):
"""