mirror of https://github.com/noisymime/OSPi.git
Only perform weather lookup if the values in the location field look like latitude / longitude
This commit is contained in:
parent
1e0b7aef60
commit
f484f5799a
7
ospi.py
7
ospi.py
|
@ -93,6 +93,13 @@ def get_temperature():
|
|||
latitude = gv.sd['loc'].split(",")[0]
|
||||
longitude = gv.sd['loc'].split(",")[1]
|
||||
|
||||
"""Check whether the values in lat/lon are numbers"""
|
||||
try:
|
||||
float(latitude)
|
||||
float(longitude)
|
||||
except ValueError:
|
||||
return("")
|
||||
|
||||
queryURL = weatherURL + "lat=" + str(latitude) + "&lon=" + str(longitude)
|
||||
response = urllib2.urlopen(queryURL)
|
||||
|
||||
|
|
Loading…
Reference in New Issue