简体   繁体   English

Amazon SP-API Python SellingApiForbiddenException:访问请求的资源被拒绝

[英]Amazon SP-API Python SellingApiForbiddenException: Access to requested resource is denied

I know this question has been asked a lot but none of the solutions helped my case.我知道这个问题被问了很多,但没有一个解决方案对我的情况有帮助。

I registered as amazon developer in my Amazon seller account and now trying to connect using python-amazon-sp-api library Here is my code:我在我的亚马逊卖家账户中注册为亚马逊开发人员,现在尝试使用 python-amazon-sp-api 库连接这是我的代码:

from sp_api.api import Orders
import datetime
import json
from datetime import timedelta
from sp_api.base import SellingApiException, Marketplaces
credentials=dict(
        refresh_token='***************', # refresh token from authorized from the app on Seller central
        lwa_app_id='****************', # lwa id of the app
        lwa_client_secret='***************', # lwa secret of the app
        aws_secret_key='************', # secret key of IAM user
        aws_access_key='************', # access key of IAM user
        role_arn='arn:aws:iam::577******:role/SPAPIRole' # IAM role arn
    )


print(json.dumps(credentials))
from sp_api.api import Orders, Finances, ProductFees
from sp_api.base import SellingApiException, Marketplaces, SellingApiForbiddenException
import datetime
from datetime import timedelta, date
import time
import csv

marketplaces = ['A2EUQ1WTGCTBG2']

res = Orders(credentials=credentials, marketplace=Marketplaces.CA) 
data = res.get_orders(CreatedAfter='2017-03-30',CreatedBefore=date.today().isoformat(),MarketplaceIds=marketplaces)

Here is the attached policy to my user(not as inline but directly attached as managed policy):这是附加给我的用户的策略(不是内联,而是直接作为托管策略附加):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "arn:aws:iam::577951966674:role/SPAPIRole"
        }
    ]
}

I have followed the API docs EXACTLY which didn't work and the policy above is what I tried to add from what I read in forums.我完全遵循了 API 文档,但它不起作用,上面的政策是我试图从我在论坛中阅读的内容中添加的内容。

开发人员中心 IAM ARN 屏幕截图

I have tried using both IAM USER ARN and ROLE ARN when adding the app in the developer central (IAM ARN section of the app)在开发人员中心(应用程序的 IAM ARN 部分)中添加应用程序时,我尝试同时使用 IAM USER ARN 和 ROLE ARN

What am I doing wrong?我究竟做错了什么?

尝试将 IAM ARN 信息替换为 aws ROLE ARN。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Amazon SP-API 速率限制 - Amazon SP-API Rate Limit sp-api - 卖家伙伴 api python - Sp-api - seller partner api python 亚马逊卖家中心 - SP-API - 创建提要文档 - InvalidInput - Amazon Seller Central - SP-API - Create a feed document - InvalidInput 亚马逊卖家中心 - SP-API - 获取货件标签 - Amazon Seller Central - SP-API - GET Labels for shipment denied:请求的资源访问在 Ubuntu 中被拒绝 - denied: requested access to the resource is denied in Ubuntu 所有报告请求的 SP-API“无效输入”错误 - SP-API "Invalid Input" error for all report requests 错误:postgress 的拉取访问被拒绝,存储库不存在或可能需要“docker 登录”:拒绝:请求的资源访问被拒绝 - ERROR: pull access denied for postgress, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 您无权在Python Eve中访问所请求的资源 - You don't have the permission to access the requested resource in Python Eve 具有“拒绝访问”错误的Python S3 Amazon代码 - Python S3 Amazon Code with 'Access Denied' Error Amazon Virtual Desktop:python脚本无法获取剪贴板:访问被拒绝 - Amazon Virtual Desktop: python script unable to fetch Clipboard : Access denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM