import re, urllib
if __name__ == "__main__":
web_page = urllib.urlopen("http://2ip.ru")
web_page = web_page.read()
ip = re.findall("(\d+\.\d+\.\d+\.\d+)", web_page)[0]
username = 'username'
password = 'password'
host = 'host'
update = urllib.urlopen("http://"+str(username)+":"+str(password)+
"@dynupdate.no-ip.com/nic/update?hostname="+str(host)+"&myip="+ ip)
res = update.read()
if re.match("(good)|(nochg)", res):
print 'ok'
else:
print 'error\n' + res