Amazon.co.uk Price Checker (Part 2)

Building on my price checker (see part 1) I’ve now added in an option asking how much spends (a.k.a pocket money) is available and allowing for the end user to enter multiple ASINs before the program checks the prices.

Next step; storing the ASINs in/reading the ASINs from a file (e.g. a CSV file).


#Amazon.co.uk Price Checker V2 / geektechstuff
import bs4, requests
#Import the Beautiful Soup and Requests modules
headers = {‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6’}
#Needed a headers otherwise Amazon.co.uk fails to give any details
spends=input(‘How much spends in £ is there?:’)
spends=float(spends)
amazlist=[]
maxLengthList=5
while len(amazlist)’)
ttext2=tail
head,sep,tail=ttext2.partition(‘<‘)
title=head.strip()
print(title)

ptext=str(asidprice)
head,sep,tail=ptext.partition(‘£’)
ptext2=tail
head,sep,tail=ptext2.partition(‘<‘) price=head print(‘£’+price) price=float(head) if price > spends:
print(“Still too expensive”)
else:
print(“Its cheap enough to purchase”)
#turns the spanIDs into strings and then removes HTML that I don’t need to print