Commit 387324c3 authored by Jason R. Coombs's avatar Jason R. Coombs

Merge pull request #3 from abadger/feature/socket-exception-import

Import socket.error so the code throws the correct exception
parents e30f3094 78a4d637
...@@ -44,6 +44,7 @@ is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection) ...@@ -44,6 +44,7 @@ is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection)
try: try:
from socket import create_connection from socket import create_connection
except ImportError: except ImportError:
from socket import error
_GLOBAL_DEFAULT_TIMEOUT = getattr(socket, '_GLOBAL_DEFAULT_TIMEOUT', object()) _GLOBAL_DEFAULT_TIMEOUT = getattr(socket, '_GLOBAL_DEFAULT_TIMEOUT', object())
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None): source_address=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment