如何使用Python对Paypal API进行TransactionSearch调用

2024-04-29 21:16:04 发布

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

我有必要的身份验证详细信息,我正在尝试进行事务搜索。我一直收到一个错误: ACK=Failure&L\u ERRORCODE0=81002&L\u SHORTMESSAGE0=未指定的%20方法&L\u LONGMESSAGE0=方法%20指定的%20is%20not%20Supported&L\u SEVERITYCODE0=错误

这是我的代码:

(timestamp, signature) = signaturegen.getAuthHeader(apiUser=settings.USERNAME, apiPass=settings.PASSWORD, accessTok=res2["token"], secTok=res2["tokenSecret"], httpMethod="POST", scriptURI="https://api-3t.sandbox.paypal.com/nvp")    
#the above operation is used to generate the timestamp and signature

headers = {"X-PAYPAL-AUTHORIZATION": "timestamp="+<timestamp>+",token="+<token>+",signature="+<signature>, "SUBJECT": settings.<API_USERNAME>}

data = {
"METHOD": "TransactionSearch",
"STARTDATE": "2012-01-01T05:38:48Z",
    }
req= urllib2.Request("https://api-3t.sandbox.paypal.com/nvp", simplejson.dumps(data), headers)
res = urllib2.urlopen(req).read()

我做错了什么。在


Tags: the方法httpscomtokenapisettings错误