我想连接我的SP-API Amazon卖家和Django

发布于 2025-01-26 10:02:05 字数 990 浏览 3 评论 0原文

嘿,我尝试为亚马逊卖家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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短暂陪伴 2025-02-02 10:02:05

我的代码在配置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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文