从 App Annie API 中提取数据 - Python

tjf*_*hme 2 python appannie

我需要使用 Python 从 App Annie 的 API 中提取一些数据。但是我无法连接。我仔细检查了我的 API 密钥和“文档”。有谁知道我如何通过他们的 API 进行连接?我不断收到 401 未经授权的访问错误。

https://support.appannie.com/hc/en-us/articles/204208864-3-Authentication

import json
import requests

url = 'https://api.appannie.com/v1.2/apps/ios/app/12345678/reviews?start_date=2012-01-01&end_date=2012-02-01&countries=US'
key = 'Authorization: bearer b7e26.........'

response = requests.get(url, key)    #After running up to this I get 401

data = json.loads(response.json())  #data is a dictionary
Run Code Online (Sandbox Code Playgroud)

ƘɌỈ*_*ƬƠƑ 5

您需要在 HTTP 标头中指定您的 api 密钥:

response = requests.get(url,
                        headers={'Authorization':'bearer b7e26.........'})
Run Code Online (Sandbox Code Playgroud)