我想连接我的SP-API Amazon卖家和Django
嘿,我尝试为亚马逊卖家SP-API修复此代码,但根本无法使用
def amazon_list(request):
#api_request = requests.get('https://jsonplaceholder.typicode.com/todos/1')
#api = json.loads(api_request.content)
#return render(request, 'shop/api.html', {'api': api})
header = {
'refresh_token':'Atzr|IwEBIO5ZRMBu6h3**********',
'lwa_client_id':'amzn1.sp.solution.cb762*********3',
'lwa_client_secret':'c99d6d067388d00c7be64150************',
'aws_access_key':'kiDJ9rM+zBdbWmSLF**********',
'aws_secret_key':'AKIAR4KA65F7DWCNKMZL',
'role_arn':'arn:aws:iam::**********:user/SellingPartnerAPI',
}
res = Orders(credentials=header, marketplace='A2EUQ1WTGCTBG2')
resultat = convert_response_to_amazon_order_list(
res.get_orders(CreatedAfter='2022-03-16', CreatedBefore=date.today().isoformat()).payload
)
return render(request, 'shop/api.html', {'api': resultat})
hey i try to fix this code for amazon seller sp-api and it's not work at all cannot connect
def amazon_list(request):
#api_request = requests.get('https://jsonplaceholder.typicode.com/todos/1')
#api = json.loads(api_request.content)
#return render(request, 'shop/api.html', {'api': api})
header = {
'refresh_token':'Atzr|IwEBIO5ZRMBu6h3**********',
'lwa_client_id':'amzn1.sp.solution.cb762*********3',
'lwa_client_secret':'c99d6d067388d00c7be64150************',
'aws_access_key':'kiDJ9rM+zBdbWmSLF**********',
'aws_secret_key':'AKIAR4KA65F7DWCNKMZL',
'role_arn':'arn:aws:iam::**********:user/SellingPartnerAPI',
}
res = Orders(credentials=header, marketplace='A2EUQ1WTGCTBG2')
resultat = convert_response_to_amazon_order_list(
res.get_orders(CreatedAfter='2022-03-16', CreatedBefore=date.today().isoformat()).payload
)
return render(request, 'shop/api.html', {'api': resultat})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的代码在配置AWS和Amazon文档中的以下步骤后正常工作,它正在修复用户以及角色和策略...并且所有工作都很好
my code work fine after configuration of aws and following steps in amazon documentation, it's fixing user and role and policy ...and all work fine