]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Cope with ssl module unavailablity using [Issue #392] method.
authorBob Halley <halley@dnspython.org>
Wed, 23 Oct 2019 14:44:03 +0000 (07:44 -0700)
committerBob Halley <halley@dnspython.org>
Wed, 23 Oct 2019 14:44:03 +0000 (07:44 -0700)
dns/query.py

index 651497623f2bcad53bebeb25cc30b8cdf9d90ef6..8f109a26578ab292a8aad3fc78932a71c6b28938 100644 (file)
@@ -23,7 +23,6 @@ import errno
 import os
 import select
 import socket
-import ssl
 import struct
 import sys
 import time
@@ -36,6 +35,19 @@ import dns.rcode
 import dns.rdataclass
 import dns.rdatatype
 
+try:
+    import ssl
+except ImportError:
+    class ssl(object):
+        class WantReadException(Exception):
+            pass
+        class WantWriteException(Exception):
+            pass
+        class SSLSocket(object):
+            pass
+        def create_default_context(self, *args, **kwargs):
+            raise Exception('no ssl support')
+
 # Function used to create a socket.  Can be overridden if needed in special
 # situations.
 socket_factory = socket.socket