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')}
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')}