0

I am writing automated api tests in python for rest api's. I have the access token but it says "Access denied". The same token works with postman request. Can someone let me know if I am missing something in my code?

import json
import requests
import urllib3
BASE_URL = <my_url>
mytoken = <my_token>
head = {'Authorization': 'Bearer ' + mytoken}
response = requests.get(BASE_URL,headers = head)
print(json.dumps(response.json(), indent=4))
print(response.status_code)

Output I get :

   {
    "Error": "Access Denied"
   }
   403

Expected result : It should return a JSON body and status code 200 with content

orde
  • 5,233
  • 6
  • 31
  • 33
Akanksha Jain
  • 21
  • 1
  • 6

0 Answers0