Add timeouts to requests calls
This commit is contained in:
parent
70bb666fa1
commit
f753479708
1 changed files with 9 additions and 2 deletions
|
|
@ -188,7 +188,13 @@ def upload_to_imgur(image_path):
|
||||||
'content-type': f'multipart/form-data; boundary={boundary}',
|
'content-type': f'multipart/form-data; boundary={boundary}',
|
||||||
'Authorization': f'Client-ID {IMGUR_CLIENT_ID}',
|
'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
|
# Return image link
|
||||||
if response.ok:
|
if response.ok:
|
||||||
|
|
@ -219,8 +225,9 @@ def upload_to_nextcloud(image_path, ticket_number, dev_name):
|
||||||
requests.put(
|
requests.put(
|
||||||
url,
|
url,
|
||||||
data=image_data,
|
data=image_data,
|
||||||
headers={'X-Requested-With': 'XMLHttpRequest'},
|
|
||||||
auth=(BENCHMARK_SERVER['User'], BENCHMARK_SERVER['Pass']),
|
auth=(BENCHMARK_SERVER['User'], BENCHMARK_SERVER['Pass']),
|
||||||
|
headers={'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
timeout=60,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Return folder link
|
# Return folder link
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue