diff --git a/lib/wttr_srv.py b/lib/wttr_srv.py index 429ea35..6590c72 100644 --- a/lib/wttr_srv.py +++ b/lib/wttr_srv.py @@ -7,6 +7,7 @@ Main wttr.in rendering function implementation import logging import os +import time from flask import render_template, send_file, make_response import wttrin_png @@ -205,6 +206,7 @@ def wttr(location, request): # We are ready to return the answer try: if 'format' in query: + location = (orig_location or location).lstrip('~') return wttr_line(location, query) if png_filename: diff --git a/lib/wttrin_png.py b/lib/wttrin_png.py index ca2ad50..4a7f1b0 100644 --- a/lib/wttrin_png.py +++ b/lib/wttrin_png.py @@ -32,7 +32,7 @@ MYDIR = os.path.abspath(os.path.dirname(os.path.dirname('__file__'))) sys.path.append("%s/lib/" % MYDIR) import parse_query -from globals import PNG_CACHE +from globals import PNG_CACHE, log COLS = 180 ROWS = 100 @@ -311,11 +311,9 @@ def make_wttr_in_png(png_name, options=None): if not os.path.exists(dirname): os.makedirs(dirname) - print "Cached file: %s" % cached_png_file if os.path.exists(cached_png_file): return cached_png_file - print "Requesting URL: %s" % url text = requests.get(url).text.replace('\n', '\r\n') curl_output = text.encode('utf-8')