Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > urllib2 auth error

Reply
Thread Tools

urllib2 auth error

 
 
rtilley
Guest
Posts: n/a
 
      02-20-2006
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
 
Reply With Quote
 
 
 
 
rtilley
Guest
Posts: n/a
 
      02-20-2006
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
windows auth and forms auth Smokey Grindle ASP .Net 1 06-08-2006 03:14 PM
Windows Auth, but Forms Auth for one page? =?Utf-8?B?ZGhucml2ZXJzaWRl?= ASP .Net 1 01-08-2005 05:50 PM
Configuring Windows Auth & Forms Auth in Asp.Net Chris Mohan ASP .Net Security 2 04-29-2004 06:46 AM
Configuring Windows Auth & Forms Auth in Asp.Net =?Utf-8?B?Q2hyaXMgTW9oYW4=?= ASP .Net 0 04-28-2004 06:11 PM
container-auth vs servlet-auth role-checking? Mark Chai Java 1 10-01-2003 06:30 PM



Advertisments