username = 'root'
password = '1234'
auth_str = '%s:%s' % (username, password)
b64_auth_str = base64.b64encode(auth_str.encode())
headers = {'Authorization': 'Basic %s' % b64_auth_str}
Above is my code for base encoding. My header become {'Authorization': "Basic b'cm9vdDoxMjM0'"}
.
But, what I need is {'Authorization': 'Basic cm9vdDoxMjM0'}
Why extra char and how to remove those?