X-Git-Url: https://git.ralfj.de/dyn-nsupdate.git/blobdiff_plain/7c4ac38811ab6a4afae9316433503a60103c865e..b1006fae0117ac7c0062e92b5842bf9eb9179c6d:/client-scripts/dyn-ns-client?ds=sidebyside diff --git a/client-scripts/dyn-ns-client b/client-scripts/dyn-ns-client index 175d880..f482c19 100755 --- a/client-scripts/dyn-ns-client +++ b/client-scripts/dyn-ns-client @@ -61,9 +61,15 @@ def getMyIP(family, config, methods = {}, verbose = 0): method = config[family]['method'] if method == 'none': return None + elif method == 'remove': + return "" elif method == 'web': server = config[family].get('server', config['DEFAULT']['server']) - ip = urlopen('https://'+server+'/checkip', config) + url = 'https://'+server+'/checkip' + try: + ip = urlopen(url, config) + except urllib.error.URLError: + raise Exception("Error fetching {}, make sure the URL is correct and the internet connection actually works.".format(url)) if verbose >= VERBOSE_FULL: print("Server",server,"says my",family,"is",ip) return ip