query our own IP only once
authorRalf Jung <post@ralfj.de>
Sun, 11 May 2014 17:17:36 +0000 (19:17 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 11 May 2014 17:17:36 +0000 (19:17 +0200)
client.py

index d32542b1e3e6b8ba579d52fabfbc0fbd4583cac5..e556ab7f4bd5f4582768f118cb7d82839b5e533b 100755 (executable)
--- 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