Created
July 12, 2012 21:04
-
-
Save slingamn/3100989 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# catch urllib3 exceptions and throw Requests exceptions | |
try: | |
# Send the request. | |
r = conn.urlopen( | |
method=self.method, | |
url=self.path_url, | |
body=body, | |
headers=self.headers, | |
redirect=False, | |
assert_same_host=False, | |
preload_content=False, | |
decode_content=False, | |
retries=self.config.get('max_retries', 0), | |
timeout=self.timeout, | |
) | |
self.sent = True | |
except MaxRetryError as e: | |
raise ConnectionError(e) | |
except (_SSLError, _HTTPError) as e: | |
if isinstance(e, _SSLError): | |
raise SSLError(e) | |
else: | |
raise Timeout('Request timed out.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment