Dear All,
Here is my python code for testing REST API -
import requests
import json
data = {
"client_id": "52ba706f-902c-4208-b28d-c05df607f3c4",
"client_secret": "de1c0400-ec02-4143-972e-752931968aed",
"grant_type": "client_credentials",
}
headers = {
'Content_type': 'application/x-www-form-urlencoded'
}
credentials = response.json()
print(credentials)
access_token = credentials['access_token']
print("Access_token: ",access_token)
auth2 = {
'Authorization': 'Bearer' +access_token
}
)
print(response)
When I run this code , I get access_token . Then I use this access token and try retrieve data. But getting authentication failure or response code 401 . My output below -
(base) esharat@esharat-desktop:~/Desktop/Library$ python3 test.py
{'access_token': 'MTY0NzM2MDQ3Mi00MzgwNzctMC42OTA2NTM5MzA1MDgxODQtM0pTSTcwdUhGcVdzaTlUUnhGcGVDaTFmaVg3Nm9v', 'expires_in': 3600, 'token_type': 'Bearer'}
Access_token: MTY0NzM2MDQ3Mi00MzgwNzctMC42OTA2NTM5MzA1MDgxODQtM0pTSTcwdUhGcVdzaTlUUnhGcGVDaTFmaVg3Nm9v
<Response [401]>
Thanks in advance .