disable logging from requests module

This commit is contained in:
Robert Kaussow 2018-06-11 23:24:13 +02:00
parent b7babf6e7c
commit 4900f7f308

View File

@ -17,6 +17,9 @@ def setup_logger():
# seup logging
logger = logging.getLogger("certbot_dns_corenetworks")
logging.basicConfig(level=logging.INFO)
# silence logging from requests module
logging.getLogger('requests').setLevel(logging.CRITICAL)
# create console handler
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
@ -88,8 +91,11 @@ def set_record(token, host, zone, logger):
try:
custom_cache_extract = tldextract.TLDExtract(
cache_file=os.path.join(os.path.expanduser("~"), "tld_set"))
domain = custom_cache_extract(os.environ['CERTBOT_DOMAIN'])
certbot_domain = "_acme-challenge.%s" % (domain.subdomain)
subdomain = custom_cache_extract(os.environ['CERTBOT_DOMAIN']).subdomain
if subdomain:
certbot_domain = "_acme-challenge.%s" % (subdomain)
else:
certbot_domain = "_acme-challenge"
certbot_validation = os.environ['CERTBOT_VALIDATION']
except KeyError, e:
logger.error("Environment Variable %s not set" % (e))