mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 08:08:00 +02:00
Move dnspython dependency to tests only and only import the dns.resolver when
actually resolving the client. That way user code that does not call 'simple_verify' for DNS01 challenges does not depend on dnspython.
This commit is contained in:
@@ -6,8 +6,6 @@ import logging
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
import dns.resolver
|
|
||||||
import dns.exception
|
|
||||||
import OpenSSL
|
import OpenSSL
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@@ -714,8 +712,12 @@ def txt_records_for_name(name):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
import dns.resolver
|
||||||
dns_response = dns.resolver.query(name, 'TXT')
|
dns_response = dns.resolver.query(name, 'TXT')
|
||||||
except dns.exception.DNSException as error:
|
except ImportError as error:
|
||||||
logger.error("Unable to resolve %s: %s", name, error)
|
raise ImportError("Local validation for 'dns-01' challenges requires "
|
||||||
|
"'dnspython'");
|
||||||
|
except Exception as error:
|
||||||
|
logger.error("Unable to resolve %s: %s", name, str(error))
|
||||||
return []
|
return []
|
||||||
return [txt_rec for rdata in dns_response for txt_rec in rdata.strings]
|
return [txt_rec for rdata in dns_response for txt_rec in rdata.strings]
|
||||||
|
|||||||
+1
-2
@@ -12,7 +12,6 @@ install_requires = [
|
|||||||
'cryptography>=0.8',
|
'cryptography>=0.8',
|
||||||
# Connection.set_tlsext_host_name (>=0.13), X509Req.get_extensions (>=0.15)
|
# Connection.set_tlsext_host_name (>=0.13), X509Req.get_extensions (>=0.15)
|
||||||
'PyOpenSSL>=0.15',
|
'PyOpenSSL>=0.15',
|
||||||
'dnspython',
|
|
||||||
'pyrfc3339',
|
'pyrfc3339',
|
||||||
'pytz',
|
'pytz',
|
||||||
'requests',
|
'requests',
|
||||||
@@ -76,7 +75,7 @@ setup(
|
|||||||
install_requires=install_requires,
|
install_requires=install_requires,
|
||||||
extras_require={
|
extras_require={
|
||||||
'docs': docs_extras,
|
'docs': docs_extras,
|
||||||
'testing': testing_extras,
|
'testing': testing_extras + 'dnspython',
|
||||||
},
|
},
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
|
|||||||
Reference in New Issue
Block a user