[modules/weather] Add API key parameter documentation and round temperature to int
This commit is contained in:
parent
a3f4b0aa6d
commit
44aa1bc564
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ Parameters:
|
||||||
* weather.interval: Interval (in minutes) for updating weather information
|
* weather.interval: Interval (in minutes) for updating weather information
|
||||||
* weather.location: Set location (ISO 3166 country code), defaults to 'auto' for getting location from http://ipinfo.io
|
* weather.location: Set location (ISO 3166 country code), defaults to 'auto' for getting location from http://ipinfo.io
|
||||||
* weather.unit: metric (default), kelvin, imperial
|
* weather.unit: metric (default), kelvin, imperial
|
||||||
|
* weather.apikey: API key from http://api.openweathermap.org
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bumblebee.input
|
import bumblebee.input
|
||||||
|
@ -58,7 +59,7 @@ class Module(bumblebee.engine.Module):
|
||||||
else:
|
else:
|
||||||
weather_url = "{url}&q={city}".format(url=weather_url, city=self._location)
|
weather_url = "{url}&q={city}".format(url=weather_url, city=self._location)
|
||||||
weather = json.loads(requests.get(weather_url).text)
|
weather = json.loads(requests.get(weather_url).text)
|
||||||
self._temperature = weather['main']['temp']
|
self._temperature = int(weather['main']['temp'])
|
||||||
self._timer += 1
|
self._timer += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue