use tldextract to splitout only subdomain
This commit is contained in:
parent
567f1ec2ff
commit
b7babf6e7c
@ -10,6 +10,7 @@ import urlparse
|
||||
import configparser
|
||||
import sys
|
||||
import logging
|
||||
import tldextract
|
||||
|
||||
|
||||
def setup_logger():
|
||||
@ -85,7 +86,10 @@ def set_record(token, host, zone, logger):
|
||||
headers = {"Authorization": "Bearer %s" % (token)}
|
||||
|
||||
try:
|
||||
certbot_domain = "_acme-challenge.%s" % (os.environ['CERTBOT_DOMAIN'])
|
||||
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)
|
||||
certbot_validation = os.environ['CERTBOT_VALIDATION']
|
||||
except KeyError, e:
|
||||
logger.error("Environment Variable %s not set" % (e))
|
||||
@ -133,8 +137,6 @@ def main():
|
||||
|
||||
# add txt record
|
||||
z_record = set_record(auth_token, config["API_HOST"], zone_name, logger)
|
||||
print z_record
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Reference in New Issue
Block a user