mirror of
https://github.com/chubin/wttr.in.git
synced 2024-10-05 01:42:07 +02:00
parent
45b9b74163
commit
e6687abf13
@ -210,11 +210,10 @@ def location_processing(location, ip_addr):
|
||||
else:
|
||||
location = NOT_FOUND_LOCATION #location[1:]
|
||||
|
||||
query_source_location = None, None
|
||||
query_source_location = get_location(ip_addr)
|
||||
|
||||
country = None
|
||||
if location is None or location == 'MyLocation':
|
||||
query_source_location = get_location(ip_addr)
|
||||
location, country = query_source_location
|
||||
|
||||
if is_ip(location):
|
||||
@ -224,7 +223,7 @@ def location_processing(location, ip_addr):
|
||||
try:
|
||||
location, country = get_location(socket.gethostbyname(location[1:]))
|
||||
except:
|
||||
query_source_location = NOT_FOUND_LOCATION, None
|
||||
location, country = NOT_FOUND_LOCATION, None
|
||||
|
||||
location = location_canonical_name(location)
|
||||
|
||||
|
@ -167,7 +167,7 @@ def wttr(location, request):
|
||||
location, override_location_name, full_address, country, query_source_location = \
|
||||
location_processing(location, ip_addr)
|
||||
|
||||
us_ip = query_source_location[1] == 'US' and 'slack' not in user_agent
|
||||
us_ip = query_source_location[1] == 'United States' and 'slack' not in user_agent
|
||||
query = parse_query.metric_or_imperial(query, lang, us_ip=us_ip)
|
||||
|
||||
# logging query
|
||||
|
Loading…
Reference in New Issue
Block a user