|
|
|
@ -375,6 +375,34 @@ def wttr(location, request):
|
|
|
|
|
parsed_query = parse_request(location, request, query, fast_mode=True)
|
|
|
|
|
response = _response(parsed_query, query, fast_mode=True)
|
|
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
# Service Down.
|
|
|
|
|
|
|
|
|
|
if os.path.exists("/tmp/service-down"):
|
|
|
|
|
# parsed_query = parse_request(location, request, query)
|
|
|
|
|
if parsed_query["html_output"]:
|
|
|
|
|
response = MALFORMED_RESPONSE_HTML_PAGE
|
|
|
|
|
http_code = 500 # Internal Server Error
|
|
|
|
|
else:
|
|
|
|
|
response = get_message("CAPACITY_LIMIT_REACHED", parsed_query["lang"])
|
|
|
|
|
http_code = 503 # Service Unavailable
|
|
|
|
|
|
|
|
|
|
# if exception is occured, we return not a png file but text
|
|
|
|
|
if "png_filename" in parsed_query:
|
|
|
|
|
del parsed_query["png_filename"]
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
_wrap_response(
|
|
|
|
|
response,
|
|
|
|
|
parsed_query["html_output"],
|
|
|
|
|
parsed_query["json_output"],
|
|
|
|
|
png_filename=parsed_query.get("png_filename"),
|
|
|
|
|
),
|
|
|
|
|
http_code,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
|
|
http_code = 200
|
|
|
|
|
try:
|
|
|
|
|
if not response:
|
|
|
|
|