HostOnNet Blog

Python script to update noip.com

I want to set DDNS (Dynamic DNS, that will point A record like yourname.no-ip.org to your dynamic IP) with www.noip.com, i don’t want to install their program. I found they allow making custom clients. I made a small program in Python to do the update. Here is the code

import urllib

myurl = "YOUR_NAME.no-ip.org"
username = "YOUR_USSERNAME_HERE"
password = "YOUR_PASSWORD_HERE"

web_page = urllib.urlopen("http://iptools.bizhat.com/ipv4.php")
myip = web_page.read()

print "Your IP is " + myip + "\n"

update_url = "http://" + username + ":" + password + "@dynupdate.no-ip.com/nic/update?hostname=" + myurl + "&myip=" + myip

print update_url + "\n"

print urllib.urlopen(update_url).read()

You can run it with crontab or schedule task.


Posted in Python