1

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

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Nick
  • 677
  • 1
  • 11
  • 25

1 Answers1

1

A 503 error response means you are sending requests to amazon too quickly. Try to increase the pause interval to 5 seconds or even 10 seconds. Also check the http response headers for the description of the 503 error. A similar problem was discussed on amazon developer forum: https://forums.aws.amazon.com/thread.jspa?messageID=564184

Nadir Latif
  • 3,690
  • 1
  • 15
  • 24
  • Generally an HTTP 429 is a server's way of telling you that you're sending too many requests too fast. A server can return a 503 if it's not ready to handle the request, is down for maintenance or the service backend is down, etc. A 503 is a temporary condition and the caller should retry after a reasonable period of time. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503 – matias elgart Dec 01 '18 at 21:45