Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Danamir committed Jan 3, 2022
2 parents 7859455 + d23a2c6 commit 7584f67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dyn_gandi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import json
import os
import sys
import re
from configparser import ConfigParser
from datetime import datetime

import docopt as docpt
import tldextract
from docopt import docopt
from ip_resolver import IpResolver, IpResolverError

Expand Down Expand Up @@ -189,12 +189,12 @@ def main():
domain = config['dns']['domain'] # type: str

# Sub-domain check
domain = domain.replace(".co.uk", ".co_uk")
if re.match(r"^.+\.[^.]+\.[^.]+$", domain):
domain_ext = tldextract.extract(domain)
if domain_ext.subdomain:
if verbose:
print("Warning: removing sub-domain part of %s" % domain)
domain = re.sub(r"^.+\.([^.]+\.[^.]+)$", r"\g<1>", domain)
domain = domain.replace(".co_uk", ".co.uk")

domain = f'{domain_ext.domain}.{domain_ext.suffix}'

if verbose:
print("Domain: %s" % domain)
Expand Down
1 change: 1 addition & 0 deletions livedns_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def _query_api(self, method, query, json_data=None):
url = "%s%s" % (self.url, urllib.parse.quote(query))

headers = {
"x-api-key": self.key,
"Authorization": "Apikey %s" % self.key,
"Accept": "application/json",
}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from setuptools import setup, find_packages

requires = [
'tldextract',
'docopt',
'requests',
]
Expand Down

0 comments on commit 7584f67

Please sign in to comment.