mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-30 07:21:12 -05:00
Fix alerts problem with parsing JSON.
This commit is contained in:
parent
156e1029b7
commit
54a79b7ab0
@ -562,7 +562,7 @@ class Weather(callbacks.Plugin):
|
|||||||
# handle alerts
|
# handle alerts
|
||||||
if args['alerts']: # only look for alerts if there.
|
if args['alerts']: # only look for alerts if there.
|
||||||
if data['alerts']: # alerts is a list. it can also be empty.
|
if data['alerts']: # alerts is a list. it can also be empty.
|
||||||
outdata['alerts'] = data['alerts']['message'] # need to do some formatting below.
|
outdata['alerts'] = data['alerts'][0]['message'] # need to do some formatting below.
|
||||||
outdata['alerts'] = outdata['alerts'].replace('\n', ' ')[:300] # \n->' ' and max 300 chars.
|
outdata['alerts'] = outdata['alerts'].replace('\n', ' ')[:300] # \n->' ' and max 300 chars.
|
||||||
outdata['alerts'] = utils.str.normalizeWhitespace(outdata['alerts']) # fix pesky double whitespacing.
|
outdata['alerts'] = utils.str.normalizeWhitespace(outdata['alerts']) # fix pesky double whitespacing.
|
||||||
else: # no alerts found (empty).
|
else: # no alerts found (empty).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user