[Tutor] Seeing response from authorization page with urllib2
crawlzone at gmail.com
Tue Sep 11 10:29:48 CEST 2012
If I open a web page in my browser, I get a pop-up window that informs
me that I need to provide authorization information. But often, in
addition, that little pop-up window will give me some additional
information supplied by the page itself. For example, the chromium
browser pop-up might say, "The server requires a username and password.
The server says: xxxxxxxxx"
But when I attempt to get any part of an authorization-required page
using urllib2.urlopen(), I immediately receive the 401 error. Even the
intended object variable is left in an undefined state, so using info()
doesn't seem to work. How can I get that information from the server?
More information about the Tutor