mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-13 23:38:24 +02:00
This commit is contained in:
@ -213,6 +213,8 @@ def location_processing(location, ip_addr):
|
|||||||
socket.gethostbyname(
|
socket.gethostbyname(
|
||||||
location.lstrip('~')[1:]))
|
location.lstrip('~')[1:]))
|
||||||
location = '~' + location
|
location = '~' + location
|
||||||
|
if 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, country = NOT_FOUND_LOCATION, None
|
||||||
@ -227,6 +229,8 @@ def location_processing(location, ip_addr):
|
|||||||
# that were derived from IPs.
|
# that were derived from IPs.
|
||||||
if location:
|
if location:
|
||||||
location = '~' + location
|
location = '~' + location
|
||||||
|
if country:
|
||||||
|
location += ", %s" % country
|
||||||
hide_full_address = not force_show_full_address
|
hide_full_address = not force_show_full_address
|
||||||
elif is_ip(location):
|
elif is_ip(location):
|
||||||
location, country = get_location(location)
|
location, country = get_location(location)
|
||||||
@ -234,6 +238,8 @@ def location_processing(location, ip_addr):
|
|||||||
# here too
|
# here too
|
||||||
if location:
|
if location:
|
||||||
location = '~' + location
|
location = '~' + location
|
||||||
|
if country:
|
||||||
|
location += ", %s" % country
|
||||||
hide_full_address = not force_show_full_address
|
hide_full_address = not force_show_full_address
|
||||||
|
|
||||||
if location and not location.startswith('~'):
|
if location and not location.startswith('~'):
|
||||||
@ -252,8 +258,6 @@ def location_processing(location, ip_addr):
|
|||||||
geolocation = geolocator(location_canonical_name(location[1:]))
|
geolocation = geolocator(location_canonical_name(location[1:]))
|
||||||
if geolocation is not None:
|
if geolocation is not None:
|
||||||
override_location_name = location[1:].replace('+', ' ')
|
override_location_name = location[1:].replace('+', ' ')
|
||||||
if country:
|
|
||||||
override_location_name += ", %s" % country
|
|
||||||
location = "%s,%s" % (geolocation['latitude'], geolocation['longitude'])
|
location = "%s,%s" % (geolocation['latitude'], geolocation['longitude'])
|
||||||
country = None
|
country = None
|
||||||
if not hide_full_address:
|
if not hide_full_address:
|
||||||
|
Reference in New Issue
Block a user