Python: Urllib2 | [Errno 54] Restablecimiento de la conexión por par

Estoy llamando a una lista de urls del mismo dominio y devolviendo un recorte de su html para unos pocos miles de dominios, pero estoy recibiendo este error de aproximadamente 1.000 filas o menos.

¿Hay algo que pueda hacer para evitar este error?¿Tiene sentido crear un paso de espera después de cada fila? cada pocos cientos de filas?

¿Hay una mejor manera de evitar esto?

  File "/Users.../ap.py", line 144, in <module> simpleProg()
  File "/Users.../ap.py", line 21, in simpleProg()
  File "/Users.../ap.py", line 57, in first_step()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 418, in _open 
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1180, in do_open
    r = h.getresponse(buffering=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1030, in getresponse
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 365, in _read_status
    line = self.fp.readline()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 447, in readline
    data = self._sock.recv(self._rbufsize)
    socket.error: [Errno 54] Connection reset by peer

Respuestas a la pregunta(0)

Su respuesta a la pregunta