one-line version: humidity
This commit is contained in:
parent
15ae405d61
commit
fde786b7b2
2 changed files with 14 additions and 2 deletions
|
|
@ -142,6 +142,7 @@ To specify your own custom output format, use the special `%`-notation:
|
||||||
|
|
||||||
```
|
```
|
||||||
c Weather condition,
|
c Weather condition,
|
||||||
|
h Humidity,
|
||||||
t Temperature,
|
t Temperature,
|
||||||
w Wind,
|
w Wind,
|
||||||
l Location,
|
l Location,
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ def render_temperature(data, query):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if query.get('use_imperial', False):
|
if query.get('use_imperial', False):
|
||||||
temperature = u'%s⁰F' % data['temp_F']
|
temperature = u'%s°F' % data['temp_F']
|
||||||
else:
|
else:
|
||||||
temperature = u'%s⁰C' % data['temp_C']
|
temperature = u'%s°C' % data['temp_C']
|
||||||
|
|
||||||
if temperature[0] != '-':
|
if temperature[0] != '-':
|
||||||
temperature = '+' + temperature
|
temperature = '+' + temperature
|
||||||
|
|
@ -59,6 +59,16 @@ def render_condition(data, query):
|
||||||
weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
|
weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
|
||||||
return weather_condition
|
return weather_condition
|
||||||
|
|
||||||
|
def render_humidity(data, query):
|
||||||
|
"""
|
||||||
|
humidity (h)
|
||||||
|
"""
|
||||||
|
|
||||||
|
humidity = data.get('humidity', '')
|
||||||
|
if humidity:
|
||||||
|
humidity += '%'
|
||||||
|
return humidity
|
||||||
|
|
||||||
def render_wind(data, query):
|
def render_wind(data, query):
|
||||||
"""
|
"""
|
||||||
wind (w)
|
wind (w)
|
||||||
|
|
@ -125,6 +135,7 @@ def render_sunset(data, query):
|
||||||
|
|
||||||
FORMAT_SYMBOL = {
|
FORMAT_SYMBOL = {
|
||||||
'c': render_condition,
|
'c': render_condition,
|
||||||
|
'h': render_humidity,
|
||||||
't': render_temperature,
|
't': render_temperature,
|
||||||
'w': render_wind,
|
'w': render_wind,
|
||||||
'l': render_location,
|
'l': render_location,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue