ebay api下面的呼叫总是失败,并将错误提供为“抱歉,开始日期或结束日期丢失或日期时间范围无效。”,但日期格式正确无误。知道它失败的原因: -
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<ebl:RequesterCredentials xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" SOAP-ENV:mustUnderstand="0">
<ebl:eBayAuthToken>my token</ebl:eBayAuthToken>
</ebl:RequesterCredentials>
</S:Header>
<S:Body>
<GetSellingManagerSoldListingsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<Version>921</Version>
<Archived>true</Archived>
<Pagination>
<EntriesPerPage>50</EntriesPerPage>
</Pagination>
<SaleDateRange>
<TimeFrom>2015-02-26T07:05:40.027Z</TimeFrom>
<TimeTo>2015-03-23T07:05:40.031Z</TimeTo>
</SaleDateRange>
</GetSellingManagerSoldListingsRequest>
</S:Body>
</S:Envelope>
答案 0 :(得分:0)
我认为问题是&#34; TimeTo&#34; 它现在不可能过去。当我尝试它时,它是2小时。所以也许它与时区有关。
这是一个完整的工作示例,python api向我展示了过去7天的销售情况:
def get_unshipped(self, days_back=7):
logger.debug("run get_unshipped()")
date_from = "{}.000Z".format(datetime.today() - timedelta(days_back))
date_to = "{}.000Z".format(datetime.today() - timedelta(minutes=120))
api = Trading(config_file=os.path.join(os.path.expanduser("~"), CONFIG_FILE), siteid=EBAY_SITE_ID)
response = api.execute("GetSellingManagerSoldListings",
{
"Archived" : "false",
"SaleDateRange" : {
"TimeFrom" : str(date_from),
"TimeTo" : str(date_to)
},
}
)
print "sales found:", len(response.dict()["SaleRecord"])
答案 1 :(得分:-1)
使用此API调用,您只能在120天内获取记录。
您的日期范围大于120天。您应该在api通话中使用Archived flag = true
指 http://developer.ebay.com/devzone/xml/docs/Reference/ebay/GetSellingManagerSoldListings.html