Handling PyAsn1Error

This commit is contained in:
Samuel Clay 2014-05-27 13:08:21 -07:00
parent a73e8830ca
commit 5e064fcc2e
2 changed files with 4 additions and 2 deletions

View file

@ -14,6 +14,7 @@ from utils import log as logging
from apps.rss_feeds.models import MFeedPage
from utils.feed_functions import timelimit
from OpenSSL.SSL import Error as OpenSSLError
from pyasn1.error import PyAsn1Error
# from utils.feed_functions import mail_feed_error_to_admin
BROKEN_PAGES = [
@ -82,7 +83,7 @@ class PageImporter(object):
response.connection.close()
except requests.exceptions.TooManyRedirects:
response = requests.get(feed_link)
except (AttributeError, SocketError, OpenSSLError), e:
except (AttributeError, SocketError, OpenSSLError, PyAsn1Error), e:
logging.debug(' ***> [%-30s] Page fetch failed using requests: %s' % (self.feed, e))
self.save_no_page()
return

View file

@ -8,6 +8,7 @@ from vendor.readability import readability
from utils import log as logging
from utils.feed_functions import timelimit, TimeoutError
from OpenSSL.SSL import Error as OpenSSLError
from pyasn1.error import PyAsn1Error
class TextImporter:
@ -97,7 +98,7 @@ class TextImporter:
r.connection.close()
except (AttributeError, SocketError, requests.ConnectionError,
requests.models.MissingSchema, requests.sessions.InvalidSchema,
LocationParseError, OpenSSLError), e:
LocationParseError, OpenSSLError, PyAsn1Error), e:
logging.user(self.request, "~SN~FRFailed~FY to fetch ~FGoriginal text~FY: %s" % e)
return
return r