如何在Jupyter Notebook中使用Adobe Analytics API 2.0

问题描述 投票:0回答:1

我想从我的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令牌?

python api oauth jupyter-notebook adobe-analytics
1个回答
0
投票

你需要将它们放在headers中,特别是通过提供headers函数的get参数的字典作为记录的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'

© www.soinside.com 2019 - 2024. All rights reserved.