如何从Trustpilot获取业务单位ID

问题描述

我无法从API trustpilot获取业务单位ID。 我尝试对授权使用其他方式,但是仍然会获得未授权https://developers.trustpilot.com/business-units-api#find-a-business-unit的文档没有帮助。 我也尝试过令牌,但是仍然存在相同的问题-未经授权。

有人可以告诉我我做错了什么吗?

我的Python代码

import requests
apikey= xxxxx
URL = 'https://api.trustpilot.com/v1/business-units/find?name=b_name?apikey={0}'.format(apikey)
response = requests.request("get",URL)
response.reason

解决方法

我发现如果将apikey添加到标题中,它将起作用。 最后看起来像这样:

import requests
apikey= xxxxx
URL = 'https://api.trustpilot.com/v1/business-units/find?name=b_name'
payload = {'apikey': apikey}
response = requests.request("get",URL,headers= payload)
response.reason