2 import urllib.request, socket, sys
4 # configuration variables
6 domains = ['domain.dyn.ralfj.de'] # list of domains to update
7 password = 'yourpassword'
8 # END of configuration variables
11 return urllib.request.urlopen(url).read().decode('utf-8').strip()
13 myip = urlopen('https://'+server+'/checkip')
15 def update_domain(domain):
16 '''Update the given domain, using the global server, user, password. Returns True on success, False on failure.'''
18 # check if the domain is already mapped to our current IP
19 domainip = socket.gethostbyname(domain)
24 # we need to update the IP
25 result = urlopen('https://'+server+'/update?password='+urllib.parse.quote(password)+'&domain='+urllib.parse.quote(domain)+'&ip='+urllib.parse.quote(myip))
26 if 'good '+myip == result:
30 # Something went wrong
31 print("Unexpected answer from server",server,"while updating",domain,"to",myip)
36 for domain in domains:
37 if not update_domain(domain):