minor fixes
This commit is contained in:
parent
c330875eda
commit
632a4169c5
2 changed files with 3 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue