Catch timeouts too

This commit is contained in:
Joseph Hall 2015-11-03 13:16:15 -07:00
parent fa46dbb2a3
commit 8d9224bd09

View File

@ -85,7 +85,7 @@ def creds(provider):
)
result.raise_for_status()
role = result.text
except requests.exceptions.HTTPError:
except (requests.exceptions.HTTPError, requests.exceptions.ConnectTimeout):
return provider['id'], provider['key'], ''
try:
@ -94,7 +94,7 @@ def creds(provider):
proxies={'http': ''}, timeout=AWS_METADATA_TIMEOUT,
)
result.raise_for_status()
except requests.exceptions.HTTPError:
except (requests.exceptions.HTTPError, requests.exceptions.ConnectTimeout):
return provider['id'], provider['key'], ''
data = result.json()