The database username and password are combined into a string ("username : password") which is then encoded using Base64. The API response contains the authorization method and encoded credentials.
Request
import requests
import json
import base64
requests.packages.urllib3.disable_warnings()
# run it from local.
db_user, db_password = 'dbc','dbc'
auth_encoded = db_user + ':' + db_password
auth_encoded = base64.b64encode(bytes(auth_encoded, 'utf-8'))
auth_str = 'Basic ' + auth_encoded.decode('utf-8')
print(auth_str)
headers = {
'Content-Type': 'application/json',
'Authorization': auth_str # base 64 encoded username:password
}
print(headers)
Note
If you are using Teradata Trial, replace the sample values dbc and dbc with your Teradata Trial username and password. The values shown in this example are placeholders and may not be valid for your environment.
Response
Basic ZGJjOmRiYw==
{
'Content-Type': 'application/json',
'Authorization': 'Basic ZGJjOmRiYw=='
}