api: Sometimes python-requests raises an SSLError on timeout.

(imported from commit 7f64659acf124819c04b5ecd67eaa5b5fddc71fd)
This commit is contained in:
Tim Abbott 2012-11-09 15:38:34 -05:00
parent 2b0ca01cdb
commit 5bdcbc7f60

View file

@ -44,7 +44,13 @@ class HumbugAPI():
sys.stdout.flush()
time.sleep(1)
continue
except requests.exceptions.Timeout:
except (requests.exceptions.Timeout, requests.exceptions.SSLError) as e:
# Timeouts are either a Timeout or an SSLError; we
# want the later exception handlers to deal with any
# non-timeout other SSLErrors
if (isinstance(e, requests.exceptions.SSLError) and
str(e) != "The read operation timed out"):
raise
if longpolling:
# When longpolling, we expect the timeout to fire,
# and the correct response is to just retry