diff options
author | liris <liris.pp@gmail.com> | 2014-04-21 21:46:32 -0400 |
---|---|---|
committer | Ralph Bean <rbean@redhat.com> | 2014-04-21 21:46:32 -0400 |
commit | 1fe931c6d2bdcd5bdd315501e4fdd621fc1d6073 (patch) | |
tree | 1c52928917157c4e48fbc3098ef1a7cc89b41f19 | |
parent | f1087fbb300ed6808e28f33e3d851b6c0263b302 (diff) | |
download | websocket-client-1fe931c6d2bdcd5bdd315501e4fdd621fc1d6073.tar.gz |
Only use ssl backports for py2.
-rw-r--r-- | websocket/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/websocket/__init__.py b/websocket/__init__.py index 46b0360..8bb9399 100644 --- a/websocket/__init__.py +++ b/websocket/__init__.py @@ -27,7 +27,11 @@ import socket try: import ssl from ssl import SSLError - from backports.ssl_match_hostname import match_hostname + if hasattr(ssl, "match_hostname"): + from ssl import match_hostname + else: + from backports.ssl_match_hostname import match_hostname + HAVE_SSL = True except ImportError: # dummy class of SSLError for ssl none-support environment. |