kyosohma at gmail.com kyosohma at gmail.com
Thu Apr 26 23:12:22 CEST 2007

On Apr 26, 12:39 pm, "Dave Dean" <dave.d... at xilinx.com> wrote:
> 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.


More information about the Python-list mailing list