@Yesterdays

Python wrapper “python-amazon-simple-product-api” using to create a new cart on Amazon?

Hello.

I'm trying to create a new cart on Amazon through using the Python wrapper "python-amazon-simple-product-api". The following code runs well.

from amazon.api import AmazonAPI
amazon = AmazonAPI("valid key","valid key","valid value")
product = amazon.lookup(ItemId='B005M393OO', ResponseGroup="Large")
product.title
product.asin


Output:

'1 X 12 Washing Machine Lint Traps Aluminum Mesh With Clamps'
'B010T3VSLW'


But, when I'm trying to create a new cart, I have the following:
amazon_cart = amazon.cart_create([{'offer_id':'B010T3VSLW','quantity': 1}])

b28f744b341c4da58110846dff14fa2b.png

So, the response is "AWS.InvalidParameterValue is not a valid value for OfferListingId. Please change this value and retry your request." It seems that there is some mistake in the arguments I use for the function create_cart, i.e.

cart_create([{'offer_id':'B010T3VSLW','quantity': 1}]).

Does anybody know a correct way to create a new cart?

Thank you.
  • Вопрос задан
  • 322 просмотра
Решения вопроса 1
angru
@angru
In accordance with Amazon API documentation ASIN is not offer ID:


An offer listing ID is an alphanumeric token that uniquely identifies an item. Use the OfferListingId instead of an item's ASIN to add the item to the cart.

Type: String
Default: None
Valid Values: An Offer Listing ID
Constraint: Required if ASIN is not used.


So you need to find way to obtain offer_id. But I can't see this functionality in python-amazon-simple-product-api library.

UPD: There is pull request
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
23 нояб. 2024, в 11:55
5000 руб./за проект
23 нояб. 2024, в 09:59
2000 руб./в час
23 нояб. 2024, в 08:36
2000 руб./за проект