mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-13 15:37:03 +02:00
Unpack region from get_location call or fail case
This commit is contained in:
@ -291,7 +291,7 @@ def location_processing(location, ip_addr):
|
|||||||
|
|
||||||
if location and location.lstrip('~ ').startswith('@'):
|
if location and location.lstrip('~ ').startswith('@'):
|
||||||
try:
|
try:
|
||||||
location, country = get_location(
|
location, region, country = get_location(
|
||||||
socket.gethostbyname(
|
socket.gethostbyname(
|
||||||
location.lstrip('~ ')[1:]))
|
location.lstrip('~ ')[1:]))
|
||||||
location = '~' + location
|
location = '~' + location
|
||||||
@ -299,7 +299,7 @@ def location_processing(location, ip_addr):
|
|||||||
location += ", %s" % country
|
location += ", %s" % country
|
||||||
hide_full_address = not force_show_full_address
|
hide_full_address = not force_show_full_address
|
||||||
except:
|
except:
|
||||||
location, country = NOT_FOUND_LOCATION, None
|
location, region, country = NOT_FOUND_LOCATION, None, None
|
||||||
|
|
||||||
query_source_location = get_location(ip_addr)
|
query_source_location = get_location(ip_addr)
|
||||||
|
|
||||||
@ -314,7 +314,8 @@ def location_processing(location, ip_addr):
|
|||||||
location = ip_addr
|
location = ip_addr
|
||||||
|
|
||||||
if is_ip(location):
|
if is_ip(location):
|
||||||
location, country = get_location(location)
|
location, region, country = get_location(location)
|
||||||
|
# location is just city here
|
||||||
|
|
||||||
# here too
|
# here too
|
||||||
if location:
|
if location:
|
||||||
|
Reference in New Issue
Block a user