Add optional headers parameter for webhooks in notify API command

This commit is contained in:
JonnyWong16 2019-11-11 15:41:11 -08:00
parent ddbd486500
commit cfc30c1234
4 changed files with 5 additions and 1 deletions

1
API.md
View file

@ -2459,6 +2459,7 @@ Required parameters:
body (str): The body of the message
Optional parameters:
headers (str): The JSON headers for webhook notifications
script_args (str): The arguments for script notifications
Returns:

View file

@ -421,6 +421,7 @@ class API2:
body (str): The body of the message
Optional parameters:
headers (str): The JSON headers for webhook notifications
script_args (str): The arguments for script notifications
Returns:

View file

@ -1179,6 +1179,7 @@ def split_args(args=None):
for arg in shlex.split(args.encode(plexpy.SYS_ENCODING, 'ignore'))]
return []
def mask_config_passwords(config):
if isinstance(config, list):
for cfg in config:

View file

@ -3613,6 +3613,7 @@ class WEBHOOK(Notifier):
}
def agent_notify(self, subject='', body='', action='', **kwargs):
subject = kwargs.get('headers', subject)
if subject:
try:
webhook_headers = json.loads(subject)
@ -3631,7 +3632,7 @@ class WEBHOOK(Notifier):
else:
webhook_body = None
headers = {'Content-type': 'application/json'}
headers = {'Content-Type': 'application/json'}
if webhook_headers:
headers.update(webhook_headers)