From a83563961cf1fa52fc60822375365b9d2f1f3bd5 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 13 Jan 2020 12:38:38 -0600 Subject: [PATCH] Kludge fix for incorrect HTTP response 500 code from trekfanfiction.net. --- fanficfare/configurable.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index 937a03a8..9f546fc9 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -1201,6 +1201,12 @@ class Configuration(configparser.SafeConfigParser): if he.code in (403,404,410): logger.debug("Caught an exception reading URL: %s Exception %s."%(unicode(safe_url(url)),unicode(he))) break # break out on 404 + ## trekfanfiction.net has started returning the page, + ## but with a 500 code. We can use the HTTPError as + ## the 'opened' in such case. + if he.code == 500 and 'trekfanfiction.net' in url: + data = he.read() + return (self._do_reduce_zalgo(self._decode(data)),he) except Exception as e: excpt=e logger.debug("Caught an exception reading URL: %s sleeptime(%s) Exception %s."%(unicode(safe_url(url)),sleeptime,unicode(e)))