Betfair history API DownloadListOfFiles不工作

2024-06-16 09:05:50 发布

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

我想调用Betfair历史数据API提供的downloadlistofile,这里是link。 但我无法理解代码的问题。我怎么能修好它?在

url = 'http://historicdata.betfair.com/api/DownloadListOfFiles'
headers = {'X-Authentication': session_token, 'content-type': 'application/json'}
jsonrpc_req = '{"sport":"Horse Racing","plan":"Basic Plan","fromDay" : 1, "fromMonth": 3,"fromYear" : 2017,"toDay": 31,"toMonth" : 3,"toYear": 2017,"eventId": null, "eventName": null,"marketTypesCollection": [ "WIN", "PLACE" ],"countriesCollection" : [ "GB", "IE" ],"fileTypeCollection" : [ "M"]}'

req = urllib2.Request(url, jsonrpc_req, headers)
response = urllib2.urlopen(req)
jsonResponse = response.read()
print jsonResponse

Tags: 代码apihttpurlresponselinkurllib2req