From 7daaffcb4a415ee3a8e0ac9e4f4f02a356d91403 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Wed, 23 Oct 2019 07:44:03 -0700 Subject: [PATCH] Cope with ssl module unavailablity using [Issue #392] method. --- dns/query.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dns/query.py b/dns/query.py index 65149762..8f109a26 100644 --- a/dns/query.py +++ b/dns/query.py @@ -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 -- 2.47.3