如何在Jupyther Noteb中使用adobeanyticsapi2.0

2024-09-24 22:24:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从我的Jupyther笔记本里调用adobeanyticsapi2.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")

显然,我得到了以下答案:

^{pr2}$

如何在请求中包含Oauth令牌?在


Tags: 数据httpsioauthapitrueauthenticationhtml
1条回答
网友
1楼 · 发布于 2024-09-24 22:24:59

您需要将它们放在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'

相关问题 更多 >