AmazonScraper module

class AmazonScraper.AmazonScraper(url)

Bases: object

This is the Scraper for Amazon. Takes in product url as input upon object creation. Method ‘job’ prints progress while method ‘check_stock’ obtains stock info and a string indicating cost of the product.
Amazon pages can have stock info in different ways. Following are the possible cases, interpretations, and return values of each case.

Case

Interpretation

Scraper return value

In Stock

Product is in stock

In Stock

Only x left Order soon

Product is in stock

In Stock

Currently unavailable

Product is out of stock

Out of Stock

In stock soon

Product is out of stock

Out of Stock

No stock info or captcha page

Stock information not available

No Stock Info


check_stock(url)

Obtains stock information from the given url.

Parameters

url – URL of the product

Returns

a string indicating the stock information and a string indicating cost of the product

job()

Prints the progress, and delegates the task to ‘check_stock’.

Returns

a string indicating the stock information and a string indicating cost of the product