mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-13 15:37:03 +02:00
minor cleanup
This commit is contained in:
@ -196,7 +196,6 @@ def location_processing(location, ip_addr):
|
|||||||
override_location_name = location[1:].replace('+', ' ')
|
override_location_name = location[1:].replace('+', ' ')
|
||||||
location = "%s,%s" % (geolocation['latitude'], geolocation['longitude'])
|
location = "%s,%s" % (geolocation['latitude'], geolocation['longitude'])
|
||||||
full_address = geolocation['address']
|
full_address = geolocation['address']
|
||||||
print full_address
|
|
||||||
else:
|
else:
|
||||||
location = NOT_FOUND_LOCATION #location[1:]
|
location = NOT_FOUND_LOCATION #location[1:]
|
||||||
try:
|
try:
|
||||||
|
@ -92,7 +92,6 @@ def get_wetter(location, ip, html=False, lang=None, query=None, location_name=No
|
|||||||
stdout = open(test_file, 'r').read()
|
stdout = open(test_file, 'r').read()
|
||||||
stderr = ""
|
stderr = ""
|
||||||
break
|
break
|
||||||
print "LOCATION = ", location
|
|
||||||
if location == NOT_FOUND_LOCATION:
|
if location == NOT_FOUND_LOCATION:
|
||||||
location_not_found = True
|
location_not_found = True
|
||||||
location = DEFAULT_LOCATION
|
location = DEFAULT_LOCATION
|
||||||
@ -194,7 +193,6 @@ def get_wetter(location, ip, html=False, lang=None, query=None, location_name=No
|
|||||||
stdout = re.sub("<head>", "<head>" + title + opengraph, stdout)
|
stdout = re.sub("<head>", "<head>" + title + opengraph, stdout)
|
||||||
open(filename+'.html', 'w').write(stdout)
|
open(filename+'.html', 'w').write(stdout)
|
||||||
|
|
||||||
print "LOCATION >>> ", location
|
|
||||||
filename = get_filename(location, lang=lang, query=query, location_name=location_name)
|
filename = get_filename(location, lang=lang, query=query, location_name=location_name)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
save_weather_data(location, filename, lang=lang, query=query, location_name=location_name, full_address=full_address)
|
save_weather_data(location, filename, lang=lang, query=query, location_name=location_name, full_address=full_address)
|
||||||
@ -221,7 +219,6 @@ def get_moon(location, html=False, lang=None):
|
|||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if lang:
|
if lang:
|
||||||
env['LANG'] = lang
|
env['LANG'] = lang
|
||||||
print cmd
|
|
||||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
|
p = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
|
||||||
stdout = p.communicate()[0]
|
stdout = p.communicate()[0]
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ def wttr(location, request):
|
|||||||
query = parse_query.metric_or_imperial(query, lang, us_ip=us_ip)
|
query = parse_query.metric_or_imperial(query, lang, us_ip=us_ip)
|
||||||
|
|
||||||
log(" ".join(map(str, [
|
log(" ".join(map(str, [
|
||||||
ip_addr, user_agent, orig_location.encode('utf-8'), location,
|
ip_addr, user_agent, (orig_location or "").encode('utf-8'), location,
|
||||||
query.get('use_imperial', False), lang
|
query.get('use_imperial', False), lang
|
||||||
])))
|
])))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user