Y
Y
Yesterdays2016-03-11 13:48:43
Python
Yesterdays, 2016-03-11 13:48:43

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, ie
cart_create([{'offer_id':'B010T3VSLW','quantity': 1}]).

Does anybody know the correct way to create a new cart?
thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
angru, 2016-03-11
@Yesterdays

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
So you need to find a way to obtain offer_id. But I can't see this functionality in python-amazon-simple-product-api library.
UPD : There is a pull request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question