I have 2 strings which are stored in variables
headers = str('{"Authorization":"'+auth+'"}')
otp = str('{"otp":"'+otp+'"}')
Using ast library I convert them to dictionary.
data = ast.literal_eval(otp)
head = ast.literal_eval(headers)
Output :
{'otp': '0910'}
{'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIU'}
But when I pass them to:
response = requests.post(url, params=data, headers = head)
I get this message
{'status': 'failure', 'message': 'invalid json'}
I understand this is a problem of single and double quotes but I am bit confused how to change single quotes to double quotes.
I tried using json.dumps() but this returns string which is not acceptable.
Please help.