minor fixes

pull/387/head
Igor Chubin 5 years ago
parent 4986f92592
commit b1ea9be11f

@ -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 = "{}"

@ -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

Loading…
Cancel
Save