My script in Python 2.7 scrapes a website every minute, but sometimes it gives the error:
urlopen error [Errno 54] Connection reset by peer>
How I can handle the exception? I am trying something like this:
from socket import error as SocketError
import errno
try:
    response = urllib2.urlopen(request).read()
except SocketError as e:
    if e.errno != errno.ECONNRESET:
        print "there is a time-out" 
    pass
        print "There is no time-out, continue"