The above suggestions seem nice, but I find this one easier: import urllib2 ext_ip = urllib2.urlopen('http://whatismyip.org/').read() print ext_ip
The nice thing about the above code is that http://whatismyip.org/ only contains exactly what you want (the ip, nothing more, nothing less), so no parsing is necessary Best, Sergio On 3/6/07, Cousin Stanley <[EMAIL PROTECTED]> wrote: > > > I have a PC behind a firewall, and I'm trying to programmatically > > determine the IP address visible from outside the firewall. > > .... > > Steven .... > > Following is another alternative that might at least > be worth consideration .... > > I use the lynx command shown as a command-line alias > under Debian linux .... > > >>> > >>> import os > >>> > >>> pipe_in = os.popen( 'lynx --dump http://checkip.dyndns.org' ) > >>> > >>> ip_addr = pipe_in.readlines() > >>> > >>> for this in ip_addr : > ... print this > ... > > > Current IP Address: 65.39.92.38 > > > -- > Stanley C. Kitching > Human Being > Phoenix, Arizona > > > ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet > News==---- > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ > Newsgroups > ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list