From: Ralf Jung Date: Sun, 11 May 2014 17:17:36 +0000 (+0200) Subject: query our own IP only once X-Git-Url: https://git.ralfj.de/dyn-nsupdate.git/commitdiff_plain/a78b59b76b259407282d8e817abdc8297fa8f9f9?ds=sidebyside query our own IP only once --- diff --git a/client.py b/client.py index d32542b..e556ab7 100755 --- a/client.py +++ b/client.py @@ -7,10 +7,12 @@ domains = ['your.domain.ralfj.de'] # list of domains to update password = 'yourpassword' # END of configuration variables +myip = urllib2.urlopen('https://'+server+'/checkip').read().strip() + def update_domain(domain): '''Update the given domain, using the global server, user, password. Returns True on success, False on failure.''' + global myip # check if the domain is already mapped to our current IP - myip = urllib2.urlopen('https://'+server+'/checkip').read().strip() domainip = socket.gethostbyname(domain) if myip == domainip: # nothing to do