urllib proxy question?

A

Alex Santos

i wrote a python prog that reads a url via urlib to find out the public ip
of the computer, my problem is that, if someone sets a proxy in teh internet
explorer, the urllib works also over a proxy and i dont get the right public
ip of my computer?

has sombody an idea, how to disable this behavior of the urllib?

thanks,
alex
 
J

John J. Lee

Alex Santos said:
i wrote a python prog that reads a url via urlib to find out the public ip
of the computer, my problem is that, if someone sets a proxy in teh internet
explorer, the urllib works also over a proxy and i dont get the right public
ip of my computer?

has sombody an idea, how to disable this behavior of the urllib?

From a quick look at the source (urllib.py):

import urllib
opener = urllib.FancyURLopener(proxies={})
r = opener.open("http://www.python.org/")
print r.read()


urllib2 will also allow you to turn off proxy support (though the docs
for proxies are a bit lacking, IIRC).

Of course, your ISP may proxy your requests even if your computer
thinks it has a 'direct' internet connection.

Presumably there's a better way, but I don't know what it is.

Why do you need to know, anyway?


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top