Sage-Bionetworks/Genie

Add tests for retry_get_url

karawoo opened this issue · 1 comments

def retry_get_url(url):
'''
Implement retry logic when getting urls.
Timesout at 3 seconds, retries 5 times.
Args:
url: Http or https url
Returns:
requests.get()
'''
s = requests.Session()
retries = Retry(total=5, backoff_factor=1)
s.mount('http://', HTTPAdapter(max_retries=retries))
s.mount('https://', HTTPAdapter(max_retries=retries))
response = s.get(url, timeout=3)
return(response)

Closing as won't do. Any new GENIE development isn't to improve code, but strictly for Consortium requested improvements or features.