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

  • Thanks for using No-IP!

  • eNeKuX

    Thanks for the script. It runs perfectly in my N900 (maemo 5).

  • My proposition of little modified script, to avoid sending of open text username and password over HTTP 😉

    import urllib2
    import base64

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

    web_page = urllib2.urlopen(“http://iptools.bizhat.com/ipv4.php”)
    myip = web_page.read()

    print “Your IP is ” + myip + “\n”

    update_url = “https://dynupdate.no-ip.com/nic/update?hostname=” + myurl + “&myip=” + myip

    req = urllib2.Request(update_url)
    req.add_header(‘Authorization’, ‘Basic ‘+base64.encodestring(username+”:”+password).replace(“\n”,””))
    resp = urllib2.urlopen(req)
    content = resp.read()
    print content

  • dodd

    sorry I don’t understand how to use this script in the windows, Anyone can explain more detail?

  • You can run it with command

    python noip.py

    Python should be in your path or use full path to python.exe

    Instead of cronjob, use Scheduled Task in Windows.

  • Matthew Tinnion

    This worked like a charm. Thanks for sharing. I was having a problem with random data being downloaded all the time on my Raspberry pi, I can now shut down the Wlan0 when im not using it and update noip after I re-instate the interface.

    solved a huge problem I didn’t have time to solve.