While porting an ap from python2.7 to python3 I see this

        base64string = base64.b64encode('%s:%s' % (wsemail, wspassword))
        request.add_header("Authorization", "Basic %s" % base64string)

in python3.x I find this works

        base64string = base64.b64encode(('%s:%s' % (wsemail, 
wspassword)).encode('ascii')).decode('ascii')
        request.add_header("Authorization", "Basic %s" % base64string)

but I find the conversion to and from ascii irksome. Is there a more direct way 
to create the basic auth value?

As an additional issue I find I have no clear idea what encoding is allowed for 
the components of a basic auth input.
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to