aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/location.py3
-rw-r--r--modules/weather.py11
2 files changed, 9 insertions, 5 deletions
diff --git a/modules/location.py b/modules/location.py
index 3fcef4ae..2415d20b 100644
--- a/modules/location.py
+++ b/modules/location.py
@@ -19,5 +19,6 @@ class Module(ModuleManager.BaseModule):
timezone = result["annotations"]["timezone"]["name"]
lat = result["geometry"]["lat"]
lon = result["geometry"]["lng"]
+ name = result["formatted"]
- return {"timezone": timezone, "lat": lat, "lon": lon}
+ return {"timezone": timezone, "lat": lat, "lon": lon, "name": name}
diff --git a/modules/weather.py b/modules/weather.py
index 202eb0fb..aa93d7f4 100644
--- a/modules/weather.py
+++ b/modules/weather.py
@@ -49,10 +49,13 @@ class Module(ModuleManager.BaseModule):
page = utils.http.request(URL_WEATHER, get_params=args, json=True)
if page:
if "weather" in page.data:
- location_parts = [page.data["name"]]
- if "country" in page.data["sys"]:
- location_parts.append(page.data["sys"]["country"])
- location_str = ", ".join(location_parts)
+ if "name" in location:
+ location_str = location["name"]
+ else:
+ location_parts = [page.data["name"]]
+ if "country" in page.data["sys"]:
+ location_parts.append(page.data["sys"]["country"])
+ location_str = ", ".join(location_parts)
celsius = "%dC" % page.data["main"]["temp"]
fahrenheit = "%dF" % ((page.data["main"]["temp"]*(9/5))+32)