Question

I'm using the Amazon product API for Python, and I'm constantly getting errors like:

File "/usr/local/lib/python2.7/dist-packages/amazonproduct/paginators.py", line 47, in __iter__
    yield self.page(self.current + 1) 
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/paginators.py", line 54, in page
    root = self.fun(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/paginators.py", line 75, in <lambda>
    method = lambda *a, **b: fnc(api, *a, **b)
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/api.py", line 360, in item_search
    SearchIndex=search_index, **params)
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/api.py", line 281, in call
    fp = self._fetch(url)
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/contrib/retry.py", line 38, in _fetch
    return API._fetch(self, url)
  File "/usr/local/lib/python2.7/dist-packages/amazonproduct/api.py", line 208, in _fetch
    response = opener.open(request)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
    line = self.fp.readline()
  File "/usr/lib/python2.7/socket.py", line 447, in readline
    data = self._sock.recv(self._rbufsize)
socket.timeout: timed out

What does this mean and how can I fix it? Does it just mean Amazon is temporarily blocking me? (my script performs constant API calls) If I restart the script it runs for a bit, but then it stops again.

Was it helpful?

Solution

Check out paragraph 4p of the API term of services: https://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html

You are not allowed to make more than 1 request per second. As you are doing "constant API calls" you might indeed be blocked.

Cheers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top