From a78b59b76b259407282d8e817abdc8297fa8f9f9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 11 May 2014 19:17:36 +0200 Subject: [PATCH] query our own IP only once --- client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.30.2