Assuming I have the following variables:
userVar = ABC
passVar = XYZ
I am familiar with this method of inserting the username and password directly but how can I use variable?
userAndPass = b64encode(b"ABC:XYZ").decode("ascii")
headerBasic = {'Authorization': 'Basic %s' % userAndPass}
This gives me the headerBasic which then I call use as a header in my API Get. How can I not insert my username and password --> b64encode(b"ABC:XYZ") I have tried to create a string like this:
str2 = userVar+":"+ passVar
userAndPass = b64encode(b"str2").decode("ascii")
it wont work.