The form-based login for a webpage can often by bypassed with the following URL structure:
https://myusername:mypassword@myserver.com
(note: I know there are security concerns here; that is beyond the scope of this question).
urllib2
doesn't like this:
urllib2.urlopen('http://myusername:mypassword@myserver.com')
InvalidURL: nonnumeric port: 'mypassword@myserver.com'
I guess it is seeing the second as the start of the URL. I know that the requests
library has no such problems. But for legacy reasons, I am stuck with using urllib2
. Is it possible to get around this with urllib2
?