Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a 2 minute timeout for all the requests #138

Merged
merged 2 commits into from
Oct 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions AnnotatorCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ReferenceGenome(Enum):
def getOncokbInfo():
ret = ['Files annotated on ' + date.today().strftime('%m/%d/%Y') + "\nOncoKB API URL: "+oncokbapiurl]
try:
info = requests.get(oncokbapiurl + "/info").json()
info = requests.get(oncokbapiurl + "/info", timeout=120).json()
ret.append('\nOncoKB data version: ' + info['dataVersion']['version']+', released on ' + info['dataVersion']['date'])
except:
log.error("error when fetch OncoKB info")
Expand All @@ -177,7 +177,7 @@ def generateReadme(outfile):

def gethotspots(url, type):
hotspots = {}
response = requests.get(url)
response = requests.get(url, timeout=120)
if response.status_code == 200:
hotspotsjson = response.json()

Expand All @@ -201,15 +201,15 @@ def makeoncokbpostrequest(url, body):
'Content-Type': 'application/json',
'Authorization': 'Bearer %s' % oncokbapibearertoken
}
return requests.post(url, headers=headers, data=json.dumps(body, default=lambda o: o.__dict__))
return requests.post(url, headers=headers, data=json.dumps(body, default=lambda o: o.__dict__), timeout=120)


def makeoncokbgetrequest(url):
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer %s' % oncokbapibearertoken
}
return requests.get(url, headers=headers)
return requests.get(url, headers=headers, timeout=120)


_3dhotspots = None
Expand Down