R
rtilley
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
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