我想从我的Jupyther Notebook内部调用Adobe Analytics API 2.0。我不需要服务器和adobe (或类似的)之间的任何“永久”身份验证,我只想获得一些(大量)数据进行分析。
我已经按照这里的描述创建了一个API键集成(https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/AuthenticationOverview/APIKeyIntegration.md)
如果我发送一个示例调用,假设:
r = requests.get("https://analytics.adobe.io/api/myID/dimensions?rsid=myreportsuite&locale=en_US&segmentable=true&reportable=true&classifiable=false")显然,我得到了以下答案:
'{"error_code":"403010","message":"Oauth token is missing."}\n'如何在我的请求中包含我的Oauth令牌?
发布于 2019-03-26 23:23:20
您需要将它们放在headers中,特别是为get函数的headers参数提供一个字典,作为文档中的here
url = 'https://api.github.com/some/endpoint'
my_api_key = 'thisismyapikey9393'
my_product_name = 'my_app_0.1'
headers = {
'x-api-key' : my_api_key,
'x-product' : my_product_name
}
r = requests.get(url, headers=headers)我在你的adobe链接中取了Step 3: Try It的头文件名。
curl 'https://stock.adobe.io/Rest/Media/1/Search/Files?locale=en_US%26search_parameters%5Bwords%5D=kittens‘-H 'x-api-key:myAPIKey’-H 'x-product:myTestApp1.0'
发布于 2020-01-24 17:05:33
使用已经为您处理身份验证等事务的库可能会更容易。我使用过python-adobe-analytics-2.0,但我自己还没有用过它。也许,即使只是为了查看代码并根据您的需要进行调整,它也是值得一试的。您可以在this website上找到有关该软件包的更多信息和文档。(不幸的是,github代码库并不能提供足够的信息)
如果你不想使用这个包,网站上还有一个关于在Adobe 2.0中使用JSON Web-Token (JWT)身份验证的教程。找到它here。
发布于 2020-07-08 05:48:28
我一直在试验这一点,并创建了一个包,以便能够构建包含多个维度/指标的请求。更多详情请访问:https://analyticsmayhem.com/adobe-analytics/reports-v2-api-python/
但是,为了发出请求,您仍然需要创建一个服务帐户来进行身份验证(https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/JWT/JWT.md)。
如果对此包有任何意见/反馈,请让我知道。
https://stackoverflow.com/questions/55360209
复制相似问题