【发布时间】:2013-09-11 17:13:47
【问题描述】:
我有必要的身份验证详细信息,并且正在尝试执行 TransactionSearch。我不断收到错误消息: 的 TIMESTAMP = 2013%2d09%2d07T19%3a06%3a35Z&的correlationID = b7af040415e92&ACK =失败&VERSION = 0%2e000000&BUILD = 7507921&L_ERRORCODE0 = 10002&L_SHORTMESSAGE0 =认证%2fAuthorization%20Failed&L_LONGMESSAGE0 =你%20do%20not%20have%20permissions%20to%20make%20this%20API %20call&L_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()
【问题讨论】:
-
这段代码由于存在几个语法错误而无法运行;它甚至不会导致您的声明收到的错误。
-
哪些语法错误??它运行并产生我在上面发布的错误。
-
<timestamp>不是有效的 Python。<token>或<signature>或<API_USERNAME>都不是。 -
那些只是占位符...我不想在这里发布我的沙盒凭据。
标签: python python-2.7 paypal paypal-sandbox