urlopen

D

Dave Dean

Hi all,
I'm running into some trouble using urllib.urlopen to grab a page from our
corporate intranet. The name of the internal site is simply http://web (no
www or com). I can use urlopen to grab a site like http://www.google.com
just fine. However, when I use urlopen to grab the internal site, I instead
get data from http://www.web.com. This is the url returned by the geturl()
function.
There must be a way to stop Python, or whoever is doing it, from changing
my url. Maybe urllib is not the correct approach. Does anyone know a
solution to this?
Thanks,
Dave
 
K

kyosohma

Hi all,
I'm running into some trouble using urllib.urlopen to grab a page from our
corporate intranet. The name of the internal site is simplyhttp://web(no
www or com). I can use urlopen to grab a site likehttp://www.google.com
just fine. However, when I use urlopen to grab the internal site, I instead
get data fromhttp://www.web.com. This is the url returned by the geturl()
function.
There must be a way to stop Python, or whoever is doing it, from changing
my url. Maybe urllib is not the correct approach. Does anyone know a
solution to this?
Thanks,
Dave

Dunno for sure, but maybe you should be using urllib2. Good info on
the module can be found here: http://www.voidspace.org.uk/python/articles/urllib2.shtml#fetching-urls

I suppose you could also edit your hosts file too.

Mike
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top