urllib2 auth error

Discussion in 'Python' started by rtilley, Feb 20, 2006.

  1. rtilley

    rtilley Guest

    I get this error:

    HTTP Error 401: Authorization Required

    When I do this:

    try:
    handler = urllib2.HTTPBasicAuthHandler()
    handler.add_password('realm', 'website', 'user', 'pass')
    opener = urllib2.build_opener(handler)
    urllib2.install_opener(opener)
    f = urllib2.urlopen('http://website')
    print f.read()
    f.close()
    except Exception, e:
    print e

    I have the right username and password. I may be using the above code
    wrong. Any tips?

    Thanks,
    Brad
     
    rtilley, Feb 20, 2006
    #1
    1. Advertising

  2. rtilley

    rtilley Guest

    rtilley wrote:
    > I have the right username and password. I may be using the above code
    > wrong. Any tips?


    I had the _wrong_ password... Sorry.
     
    rtilley, Feb 20, 2006
    #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. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    702
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Windows Auth, but Forms Auth for one page?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Jan 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    564
    Elton Wang
    Jan 8, 2005
  3. Mark Chai
    Replies:
    1
    Views:
    741
    Christophe Vanfleteren
    Oct 1, 2003
  4. Chris Mohan

    Configuring Windows Auth & Forms Auth in Asp.Net

    Chris Mohan, Apr 28, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    429
    Chris Mohan
    Apr 29, 2004
  5. Forms Auth Info passed to Windows Auth?

    , Apr 28, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    220
    Hernan de Lahitte
    May 3, 2005
Loading...

Share This Page