'i want connect my sp-api amazon seller and django
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})
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | samir sahal |