Answers for "authentication base64 encode python"

12

base64 encode python

import base64

message = "Python is fun"
message_bytes = message.encode('ascii')
base64_bytes = base64.b64encode(message_bytes)
base64_message = base64_bytes.decode('ascii')

print(base64_message)
Posted by: Guest on January-22-2021
0

python3 base64 encode basic authentication

userpass = username + ':' + password
encoded_u = base64.b64encode(userpass.encode()).decode()
headers = {"Authorization" : "Basic %s" % encoded_u}
Posted by: Guest on February-26-2020

Python Answers by Framework

Browse Popular Code Answers by Language