Skip to content

Commit

Permalink
small change
Browse files Browse the repository at this point in the history
  • Loading branch information
otdftr authored Feb 6, 2024
1 parent 5d447aa commit 71b8e3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mqttwarn/services/http_urllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ def plugin(srv, item):

if params is not None:

# shorthand [ 'param1' ] for { 'param1': '{param1}, ...}
# shorthand [ 'param1' ] for { 'param1': '{param1}', ...}
if isinstance(params, list):
# create dict from list and replace params
newparams = {}
for key in params:
if key.startswith('@') or key.startswith('?'):
newparams[key[1:]] = key
else:
newparams[key] = key
newparams[key] = '@' + key
params = newparams

for key in list(params.keys()):
Expand All @@ -73,7 +73,7 @@ def plugin(srv, item):
# Quoted field, starts with '@'. Do not use .format, instead grab
# the item's [message] and inject as parameter value.
# { 'x' : '?param' }
# optional field, add to query string only if it exists in data and is not empty
# optional quoted field, add to query string only if it exists in item's data and is not empty
if params[key].startswith('@'): # "@message"
params[key] = item.get(params[key][1:], "NOP")

Expand Down

0 comments on commit 71b8e3b

Please sign in to comment.