Senthil Kumaran <[email protected]> added the comment:
There is a OLD Known issue that base64.encodestring will insert in a line-break
in the authorization header. See Issue1574068
I fear, you might have done something like this.
base64string = base64.encodestring('%s:%s' %(username,passwd))[:-1]
request.add_header("Authorization","Basic %s" % base64string)
urllib2.urlopen(request)
You might have encountered this problem of Request not working with long
authorization headers.
Instead, if you do
base64string = base64.b64encode('%s:%s' %(username,passwd))[:-1]
and then add the string to your headers, it might work properly. It does so for
me.
(alternatively you can set base64.MAXBINSIZE=1000000, but the first solution is
much cleaner.
I am closing this bug as Invalid. If you feel, it is valid and you used
base64.b64encode for encoding the Basic Authentication header. feel free to
reopen the bug, with a snippet of code attached.
----------
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6452>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com