使用 python 从 curl 请求中获取数据
Grabbing data from a curl request using python
我正在尝试使用此 curl 请求:
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请求。我该怎么做?
以下是一些文档信息:
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/token
http://docs.python-requests.org/en/master/
我正在尝试使用此 curl 请求:
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请求。我该怎么做?
以下是一些文档信息:
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/token http://docs.python-requests.org/en/master/