gpt4 book ai didi

python - 无效的源路径/_links/source/href - Django

转载 作者:太空宇宙 更新时间:2023-11-03 14:44:35 24 4
gpt4 key购买 nike

我有一个 Dwolla api 请求,我正在尝试发送,但我收到了一个我无法弄清楚的路径无效路径错误。因此,主要错误来自请求正文,即使我确保它与 api 文档示例类似,并替换了数据库中的信息。

谁能帮我弄清楚发生了什么以及导致错误的原因。

以下是 Dwolla api 文档中的示例:

request_body = {
'_links': {
'source': {
'href': 'https://api-sandbox.dwolla.com/funding-sources/707177c3-bf15-4e7e-b37c-55c3898d9bf4'
},
'destination': {
'href': 'https://api-sandbox.dwolla.com/customers/07D59716-EF22-4FE6-98E8-F3190233DFB8'
}
},
'amount': {
'currency': 'USD',
'value': '1.00'
},
'metadata': {
'paymentId': '12345678',
'note': 'payment for completed work Dec. 1'
},
'clearing': {
'destination': 'next-available'
},
'correlationId': '8a2cdc8d-629d-4a24-98ac-40b735229fe2'
}

transfer = app_token.post('transfers', request_body)

这是我从收集信息的示例中获得的输出:

{  
'_links':{
'source':{
'href':'https://api-sandbox.dwolla.com/funding-sources/..a295c'
},
'destination':{
'href':'https://api-sandbox.dwolla.com/funding-sources/..ae0fc'
}
},
'amount':{
'currency':'USD',
'value':'15.00'
},
'metadata':{
'paymentId':'507133793',
'note':'wild night'
},
'clearing':{
'destination':'next-available'
},
'correlationId':'8a2cdc8d-629d-4a24-98ac-40b735229fe2'
}

这是发生的确切错误:

ValidationError at /4/4/add_transaction/
{"code":"ValidationError","message":"Validation error(s) present. See embedded errors list for more details.","_embedded":{"errors":[{"code":"Invalid","message":"Invalid funding source.","path":"/_links/source/href","_links":{}}]}}

最佳答案

验证错误应包含嵌入的错误列表,其中包含顶级错误代码、简短消息(错误描述)以及指向无效字段的指针的路径。在这种情况下,有一些事情可能会返回无效的资金来源。发送资金来源。

  • 资金来源的状态是否“已验证”?所有资金来源都需要经过验证才有资格发送。
  • 该网址是否有效,是否指向您有权发送资金的用户帐户的资金来源?

我的假设是,当需要验证时,资金来源“未经验证”,但请检查这几项内容,看看是否可以解决错误!引用our docs了解有关资金来源验证的更多信息。

关于python - 无效的源路径/_links/source/href - Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46337366/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com