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