From b1ea9be11f164012458e61b1333ce731ab770a56 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 28 Dec 2019 18:08:06 +0100 Subject: [PATCH] minor fixes --- bin/proxy.py | 3 +-- lib/wttr_srv.py | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/proxy.py b/bin/proxy.py index 96d22a3..d38244f 100644 --- a/bin/proxy.py +++ b/bin/proxy.py @@ -63,7 +63,6 @@ def load_translations(): return translations TRANSLATIONS = load_translations() - def _find_srv_for_query(path, query): # pylint: disable=unused-argument return 'http://api.worldweatheronline.com' @@ -206,8 +205,8 @@ def proxy(path): if response: headers = {} headers['Content-Type'] = response.headers['content-type'] + _save_content_and_headers(path, query_string, response.content, headers) content = add_translations(response.content, lang) - _save_content_and_headers(path, query_string, content, headers) else: content = "{}" diff --git a/lib/wttr_srv.py b/lib/wttr_srv.py index e389e6d..a55c934 100644 --- a/lib/wttr_srv.py +++ b/lib/wttr_srv.py @@ -301,14 +301,14 @@ def wttr(location, request): return _wrap_response(output, html_output) - except RuntimeError as exception: - if 'Malformed response' in str(exception) \ - or 'API key has reached calls per day allowed limit' in str(exception): + except Exception as exception: + # if 'Malformed response' in str(exception) \ + # or 'API key has reached calls per day allowed limit' in str(exception): if html_output: return _wrap_response(MALFORMED_RESPONSE_HTML_PAGE, html_output) return _wrap_response(get_message('CAPACITY_LIMIT_REACHED', lang).encode('utf-8'), html_output) - logging.error("Exception has occured", exc_info=1) - return "ERROR" + # logging.error("Exception has occured", exc_info=1) + # return "ERROR" if __name__ == "__main__": import doctest