- dns client

Skip Montanaro skip at
Thu Nov 9 14:08:31 CET 2000

    Anders> There are some clients at the site, but they are
    Anders> written in perl and my computer is a perl free zone!

I'll probably make a mistake transcribing the perl code (and since I don't
use I can't really test it anyway), but here's a first cut that
should get you close.

    import urllib, os, re

    # modify to suit your environment and myIP account info
    interface = "ppp0"
    userid = "myiploginname"
    pwd = "myippassword"
    hostname = ""
    recordtype = "A"
    # end of modification section

    ipdata = os.popen("ifconfig " + interface)
    ipaddress = None
    for line in ipdata.readlines():
	mat ="addr:(\d+\.\d+\.\d+\.\d+)")
	if mat is not None:
	    ipaddress =

    if ipaddress is None:
       raise ValueError, "couldn't read my IP address!"

    f = urllib.urlopen(""


Skip Montanaro (skip at
Support the Affiliates Program:

More information about the Python-list mailing list