no traceback for proxy error

This commit is contained in:
j 2016-02-18 17:08:41 +05:30
parent 22099d4b9a
commit fcb069c7de

View file

@ -12,6 +12,7 @@ from datetime import datetime
import os
import time
import socket
import socks
import ox
from tornado.ioloop import PeriodicCallback
@ -300,6 +301,9 @@ class Node(Thread):
except socket.timeout:
logger.debug('timeout %s', url)
return False
except socks.GeneralProxyError:
logger.debug('openurl failed %s', url)
return False
except:
logger.debug('openurl failed %s', url, exc_info=True)
return False
@ -357,6 +361,12 @@ class Node(Thread):
self._opener.addheaders = list(zip(self.headers.keys(), self.headers.values()))
try:
r = self._opener.open(url, timeout=self.TIMEOUT*2)
except socket.timeout:
logger.debug('timeout %s', url)
return False
except socks.GeneralProxyError:
logger.debug('download failed %s', url)
return False
except:
logger.debug('download failed %s', url, exc_info=True)
self.online = False