This code worked with Python 2.7 but on Python 3.4 I get "string argument without an encoding" error
headers = {'Authorization' : 'Basic ' + base64.b64encode(bytes('Someuser:Somepassword')).encode('ascii')}
The bytes() class constructor now expects the encoding as second param. Example:
bytes("mystring", "ascii")
I guess you need something like this:
headers = {'Authorization' : 'Basic ' + base64.b64encode(bytes('Someuser:Somepassword','ascii')).decode('ascii')}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With