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,
|
||||
h Humidity,
|
||||
t Temperature,
|
||||
w Wind,
|
||||
l Location,
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ def render_temperature(data, query):
|
|||
"""
|
||||
|
||||
if query.get('use_imperial', False):
|
||||
temperature = u'%s⁰F' % data['temp_F']
|
||||
temperature = u'%s°F' % data['temp_F']
|
||||
else:
|
||||
temperature = u'%s⁰C' % data['temp_C']
|
||||
temperature = u'%s°C' % data['temp_C']
|
||||
|
||||
if temperature[0] != '-':
|
||||
temperature = '+' + temperature
|
||||
|
|
@ -59,6 +59,16 @@ def render_condition(data, query):
|
|||
weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
|
||||
return weather_condition
|
||||
|
||||
def render_humidity(data, query):
|
||||
"""
|
||||
humidity (h)
|
||||
"""
|
||||
|
||||
humidity = data.get('humidity', '')
|
||||
if humidity:
|
||||
humidity += '%'
|
||||
return humidity
|
||||
|
||||
def render_wind(data, query):
|
||||
"""
|
||||
wind (w)
|
||||
|
|
@ -125,6 +135,7 @@ def render_sunset(data, query):
|
|||
|
||||
FORMAT_SYMBOL = {
|
||||
'c': render_condition,
|
||||
'h': render_humidity,
|
||||
't': render_temperature,
|
||||
'w': render_wind,
|
||||
'l': render_location,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue