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