Browse Source

Catch maxretry error

Don't fill logs with duplicate logs
pull/2718/head
Ruud 11 years ago
parent
commit
6cc802952f
  1. 8
      couchpotato/core/plugins/base.py

8
couchpotato/core/plugins/base.py

@ -5,6 +5,8 @@ from couchpotato.core.helpers.variable import getExt, md5, isLocalIP
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.environment import Env from couchpotato.environment import Env
import requests import requests
from requests.packages.urllib3 import Timeout
from requests.packages.urllib3.exceptions import MaxRetryError
from tornado import template from tornado import template
from tornado.web import StaticFileHandler from tornado.web import StaticFileHandler
from urlparse import urlparse from urlparse import urlparse
@ -173,9 +175,9 @@ class Plugin(object):
data = response.content if return_raw else response.text data = response.content if return_raw else response.text
self.http_failed_request[host] = 0 self.http_failed_request[host] = 0
except IOError: except (IOError, MaxRetryError, Timeout):
if show_error: if show_error:
log.error('Failed opening url in %s: %s %s', (self.getName(), url, traceback.format_exc(1))) log.error('Failed opening url in %s: %s %s', (self.getName(), url, traceback.format_exc(0)))
# Save failed requests by hosts # Save failed requests by hosts
try: try:
@ -265,7 +267,7 @@ class Plugin(object):
if not kwargs.get('show_error', True): if not kwargs.get('show_error', True):
raise raise
log.error('Failed getting cache: %s', (traceback.format_exc())) log.debug('Failed getting cache: %s', (traceback.format_exc(0)))
return '' return ''
def setCache(self, cache_key, value, timeout = 300): def setCache(self, cache_key, value, timeout = 300):

Loading…
Cancel
Save