Discussion

Ask a Question
Back to All

How can i connect to api target process with python langage

Hello,

I have a request , i try to connect with python and i'm using the requests library . But i have a bad request Can you help me please ?

My script :

import requests

hostname = 'http://bedrock.tpondemand.com/'
authenticationToken = 'NTY1OnN0Vzg5S1VVSHRGNndyeVkwM3Z6enNEbnU0YjdBNVc4UUdvNjhPKzN3M1E9'
isTokenSetFromUserProfileTab = True
takeCount = 10
entityTypeResourceName = 'userstories'
filter = ''
includeFields = ''

headers = {
'content-type' : 'application/json',
'token': authenticationToken
}

dataUrl = f'{hostname}api/v1/{entityTypeResourceName}'
print(dataUrl)
r = requests.get(dataUrl, headers=headers)
print(r.json)

////////

Response

<bound method Response.json of <Response [401]>>