Home > Back-end >  How to create an api request in python with apy key
How to create an api request in python with apy key

Time:08-13

I need to make an api call with api key in django ,this works in postman :

enter image description here

i have tried it in python :

header={"content-type": "application/json","Authorization": "X-Api-Key %s" %(self.api_key)}

r = requests.post(email_meta_path,json=json,header=header)

but i got authentication credintionals error , how can i create the postman request in python ?

CodePudding user response:

You could use the code snippet option in Postman (Located on the right-hand side, usually minimised);

enter image description here

Select the language you want to use and it should give you the code from your request;

enter image description here

  • Related