我试图使用此卷曲请求:
curl 'https://cloud.estimote.com/v2/analytics/visits?from=1448928000&to=1451606399&granularity=daily' -X GET -u YOUR_SDK_APP_ID:YOUR_SDK_APP_TOKEN
以这种形式输出数据
{
"data": [{
"date": "2016-02-22",
"count": 183
}, {
"date": "2016-02-23",
"count": 162
}]
}
我想用python来调用curl请求。我该怎么做?
答案 0 :(得分:1)
import requests
response = requests.get('https://cloud.estimote.com/v2/analytics/visits?from=1448928000&to=1451606399&granularity=daily', headers={'Authorization': 'access_token myToken'})
然后,您可以查看响应信息,例如response.content,response.text等...
这样的东西,取决于api /令牌 http://docs.python-requests.org/en/master/