From 4900f7f3080c7cc6a80b08c50ad5469fc5ecdfc5 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 11 Jun 2018 23:24:13 +0200 Subject: [PATCH] disable logging from requests module --- authenticator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/authenticator.py b/authenticator.py index b1bb30d..0fad8b7 100755 --- a/authenticator.py +++ b/authenticator.py @@ -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))