Add timeouts to requests calls

This commit is contained in:
2Shirt 2022-12-15 17:06:44 -08:00
parent 70bb666fa1
commit f753479708
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -188,7 +188,13 @@ def upload_to_imgur(image_path):
'content-type': f'multipart/form-data; boundary={boundary}',
'Authorization': f'Client-ID {IMGUR_CLIENT_ID}',
}
response = requests.request('POST', url, data=payload, headers=headers)
response = requests.request(
'POST',
url,
data=payload,
headers=headers,
timeout=60,
)
# Return image link
if response.ok:
@ -219,8 +225,9 @@ def upload_to_nextcloud(image_path, ticket_number, dev_name):
requests.put(
url,
data=image_data,
headers={'X-Requested-With': 'XMLHttpRequest'},
auth=(BENCHMARK_SERVER['User'], BENCHMARK_SERVER['Pass']),
headers={'X-Requested-With': 'XMLHttpRequest'},
timeout=60,
)
# Return folder link