使用Python请求进行类似curl的请求?

时间:2014-04-24 17:12:59

标签: python curl python-requests

我需要发出一个python请求,如下所示:

curl --header "Authorization: XXXXXXXXXXXXX"
https://api.getnomi.com/v2/reports/conversion?account=XXXXXXXXXXXXXX
\&store=XXXXXXXXXX\&date_from=1329238082\&date_to=1360860473

我试过了:

import requests as r

auth_code = "XXXXXXXXXXX"
account_id = "XXXXXXXXXXX"
store_id = "XXXXXXXXXXXXXX"

test_url = "https://api.getnomi.com/v2/reports/conversion?"


header = {"Authorization": auth_code}
payload = {"account": account_id, "store": store_id,
           "date_from": 1398272878, "date_to": 1398359278}

data = r.get(test_url, params=payload, headers=header)

我不断收到此回复<Response [404]>

知道为什么吗?

0 个答案:

没有答案