简体   繁体   English

Python Amazon Product API常量socket.timeout错误

[英]Python Amazon Product API Constant socket.timeout errors

I'm using the Amazon product API for Python, and I'm constantly getting errors like: 我正在使用适用于Python的Amazon产品API,并且不断收到如下错误:

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? 这是否仅表示Amazon暂时阻止了我? (my script performs constant API calls) If I restart the script it runs for a bit, but then it stops again. (我的脚本执行恒定的API调用)如果我重新启动脚本,它将运行一会儿,但随后又会停止。

Check out paragraph 4p of the API term of services: https://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html 查阅API服务条款第4p段: https : //affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html

You are not allowed to make more than 1 request per second. 不允许您每秒发出1个以上的请求。 As you are doing "constant API calls" you might indeed be blocked. 当您执行“恒定的API调用”时,您可能确实被阻止了。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM