It looks like there's a problem with the program. It's sending so many requests that it overwhelmed the Beans'R'Us website. So why did that happen? Let's look at the code and see:
fWs the tode import urllib.request ^ jt^duv-v-eirfcly price = 99.99 while price > 4.74:
page = urllib.request.urlopen("http://www.beans-r-us.biz/prices.html") text = page.read().decode("utf8") where = text.find('>$') start_of_price = where + 2 end_of_price = start_of_price + 4 price = float(text[start_of_price:end_of_price]) print ("Buy!")
If the value of price isn't low enough (if it's more than 4.74), the program goes back to the top of the loop immediately and sends another request.
With the code written this way, the program will generate thousands of requests per hour. Multiply that by all the Starbuzz outlets around the world, and you can start to see the scale of the problem:
You need to delay the pricing requests. But how?
Was this article helpful?