diff --git a/README.md b/README.md index cb486da..8d690ad 100644 --- a/README.md +++ b/README.md @@ -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, diff --git a/lib/wttr_line.py b/lib/wttr_line.py index f364ae6..f3bd84e 100644 --- a/lib/wttr_line.py +++ b/lib/wttr_line.py @@ -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,