PayPal 请求中无法识别的令牌 'transaction_id'
Unrecognized token 'transaction_id' in PayPal request
我觉得我只是在某些语法上做错了,找不到任何解决方案。
url = 'https://api-m.paypal.com/v1/shipping/trackers/%s-%s' % (paypal_transaction_token, tracking_number)
print("url is", url)
headers = {
'Content-Type' : 'application/json',
'Authorization' : 'Bearer %s' % access_token,
}
print('headders here', headers)
data = {
"transaction_id": "%s" % paypal_transaction_token,
"tracking_number":"%s" % tracking_number,
"status": "%s" % status,
"carrier": "%s" % carrier
}
print("data", data)
response = requests.put(url, headers=headers, data=data)
我一直收到的错误是 Unrecognized token 'transaction_id'
,如果我删除 transaction_id,无论哪个数据参数是第一个,我都会得到相同的错误。
根据文档,这一切都是正确的,所以我假设它在我的代码中是错误的:
https://developer.paypal.com/docs/tracking/integrate/#update-or-cancel-tracking-information
https://developer.paypal.com/docs/api/tracking/v1/
我的代码有什么问题?
我也尝试过不使用 %s
。
The error I keep receiving is Unrecognized token 'transaction_id' and if I remove transaction_id I just get the same error for whichever data param is first.
requests.put
将 形成编码 数据,而 PayPal API
接受 JSON。做:
data=json.dumps(data)
我觉得我只是在某些语法上做错了,找不到任何解决方案。
url = 'https://api-m.paypal.com/v1/shipping/trackers/%s-%s' % (paypal_transaction_token, tracking_number)
print("url is", url)
headers = {
'Content-Type' : 'application/json',
'Authorization' : 'Bearer %s' % access_token,
}
print('headders here', headers)
data = {
"transaction_id": "%s" % paypal_transaction_token,
"tracking_number":"%s" % tracking_number,
"status": "%s" % status,
"carrier": "%s" % carrier
}
print("data", data)
response = requests.put(url, headers=headers, data=data)
我一直收到的错误是 Unrecognized token 'transaction_id'
,如果我删除 transaction_id,无论哪个数据参数是第一个,我都会得到相同的错误。
根据文档,这一切都是正确的,所以我假设它在我的代码中是错误的:
https://developer.paypal.com/docs/tracking/integrate/#update-or-cancel-tracking-information https://developer.paypal.com/docs/api/tracking/v1/
我的代码有什么问题?
我也尝试过不使用 %s
。
The error I keep receiving is Unrecognized token 'transaction_id' and if I remove transaction_id I just get the same error for whichever data param is first.
requests.put
将 形成编码 数据,而 PayPal API
接受 JSON。做:
data=json.dumps(data)