Add optional headers parameter for webhooks in notify API command
This commit is contained in:
1
API.md
1
API.md
@@ -2459,6 +2459,7 @@ Required parameters:
|
|||||||
body (str): The body of the message
|
body (str): The body of the message
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
|
headers (str): The JSON headers for webhook notifications
|
||||||
script_args (str): The arguments for script notifications
|
script_args (str): The arguments for script notifications
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@@ -421,6 +421,7 @@ class API2:
|
|||||||
body (str): The body of the message
|
body (str): The body of the message
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
|
headers (str): The JSON headers for webhook notifications
|
||||||
script_args (str): The arguments for script notifications
|
script_args (str): The arguments for script notifications
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@@ -1179,6 +1179,7 @@ def split_args(args=None):
|
|||||||
for arg in shlex.split(args.encode(plexpy.SYS_ENCODING, 'ignore'))]
|
for arg in shlex.split(args.encode(plexpy.SYS_ENCODING, 'ignore'))]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def mask_config_passwords(config):
|
def mask_config_passwords(config):
|
||||||
if isinstance(config, list):
|
if isinstance(config, list):
|
||||||
for cfg in config:
|
for cfg in config:
|
||||||
|
@@ -3613,6 +3613,7 @@ class WEBHOOK(Notifier):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def agent_notify(self, subject='', body='', action='', **kwargs):
|
def agent_notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
subject = kwargs.get('headers', subject)
|
||||||
if subject:
|
if subject:
|
||||||
try:
|
try:
|
||||||
webhook_headers = json.loads(subject)
|
webhook_headers = json.loads(subject)
|
||||||
@@ -3631,7 +3632,7 @@ class WEBHOOK(Notifier):
|
|||||||
else:
|
else:
|
||||||
webhook_body = None
|
webhook_body = None
|
||||||
|
|
||||||
headers = {'Content-type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
if webhook_headers:
|
if webhook_headers:
|
||||||
headers.update(webhook_headers)
|
headers.update(webhook_headers)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user