urlopen

Discussion in 'Python' started by Dave Dean, Apr 26, 2007.

  1. Dave Dean

    Dave Dean Guest

    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
    Dave Dean, Apr 26, 2007
    #1
    1. Advertising

  2. Dave Dean

    Guest

    On Apr 26, 12:39 pm, "Dave Dean" <> 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.

    Mike
    , Apr 26, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MAK
    Replies:
    5
    Views:
    522
    Mike Brown
    Aug 22, 2003
  2. Xu, C.S.
    Replies:
    5
    Views:
    462
    John J. Lee
    Sep 17, 2003
  3. Chris Withers

    urllib.urlopen with threads

    Chris Withers, Oct 9, 2003, in forum: Python
    Replies:
    0
    Views:
    307
    Chris Withers
    Oct 9, 2003
  4. Chris Withers

    Re: urllib.urlopen with threads

    Chris Withers, Oct 9, 2003, in forum: Python
    Replies:
    0
    Views:
    393
    Chris Withers
    Oct 9, 2003
  5. Chris
    Replies:
    0
    Views:
    1,034
    Chris
    Jul 10, 2005
Loading...

Share This Page