You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting the child-product ASIN directly from the page would be ideal, but for color-size combos that aren't available, Amazon will redirect to a different color with the selected size. This changes the ASIN in all href links.
Basically, I want to get the child ASIN that is a specific color and size (say, White-white, size 8.5 US), but I can't seem to extract the variation part using the wrapper in order to extract it.
Any ideas?
The text was updated successfully, but these errors were encountered:
Unfortunately, it seems like this package doesn't currently support what you want explicitly. I opened a feature request (#133) for a few elements of the Amazon API that are also not supported.
You can use it to get the raw variations XML result using the keyword arg ResponseGroup='Variations'. I've been doing something similar with "AlternativeVersions", which gives different versions of books, and then processing it using lxml.etree (this package depends on it, so you should already have it installed).
Here's how you'd get your raw xml and get the etree node. You can learn how to further process XML like this in various tutorials.
(Note that I haven't actually tested the etree code here)
import os
from lxml import etree
from amazon.api import AmazonAPI
get = os.environ.get
amazon = AmazonAPI(get("AMAZON_ACCESS_KEY"),
get("AMAZON_SECRET_KEY"),
get("AMAZON_ASSOC_TAG"))
sneaker_result = amazon.lookup(ItemId="B01N8TRZDX",
IdType='ASIN',
ResponseGroup='Variations')
raw_xml = sneaker_result.to_string()
root = etree.fromstring(raw_xml)
root.find("{*}VariationsSummary")
You can navigate through the long list of variations and pick out all the child ASINs and availability statuses of offers using the etree.
So basically I'm trying to write a script that will check for the availability of a currently-out-of-stock item.
Here's the URL of the product page:
https://www.amazon.com/Adidas-Originals-Primeknit-Trainers-Sneakers/dp/B07177WSCC/ref=sr_1_2?s=apparel&ie=UTF8&qid=1517048725&sr=1-2&nodeID=7147441011&psd=1&keywords=adidas+Originals+Men%27s+Stan+Smith+OG+PK+Fashion+Sneaker
Parent ASIN: B01N8TRZDX
Getting the child-product ASIN directly from the page would be ideal, but for color-size combos that aren't available, Amazon will redirect to a different color with the selected size. This changes the ASIN in all href links.
Basically, I want to get the child ASIN that is a specific color and size (say, White-white, size 8.5 US), but I can't seem to extract the variation part using the wrapper in order to extract it.
Any ideas?
The text was updated successfully, but these errors were encountered: