Using AmazonApi for python, gives me error 503. It is really strange as the same script has worked until three days ago. Since then it gives error 503. I did some research and found that amazon fires 503 when too many requests are submitted for a second. I do process an item every 5 seconds, I do want to get price and name and I have even the lazy sleep(1)
between them.
I saw someone suggested to use headers in order to make it work, but it still doesn't.
amazon_uk = AmazonAPI('credentials', region="UK")
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36'}
then I do take the name and price by :
NAME = amazon_uk.lookup(ItemId=url).title
sleep(1)
SALE_PRICE = amazon_uk.lookup(ItemId=url).price_and_currency
where url
is taken from a file.
Strange thing is sometimes it goes up to the 30th item, sometimes it crashes only at the 1st.
P.S. even if I put sleep
everywhere it still fires the error.
Does someone encountered it?
Thanks