mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-29 11:09:27 -05:00
Fix: json-encode WH data if specified as params
This commit is contained in:
parent
cd50f20a20
commit
f3c0cf3886
@ -573,14 +573,22 @@ def run_workflows_updated(sender, document: Document, logging_group=None, **kwar
|
||||
max_retries=3,
|
||||
throws=(httpx.HTTPError,),
|
||||
)
|
||||
def send_webhook(url, data, headers, files):
|
||||
def send_webhook(url: str, data: dict | str, headers: dict, files: dict | None):
|
||||
try:
|
||||
httpx.post(
|
||||
url,
|
||||
data=data,
|
||||
files=files,
|
||||
headers=headers,
|
||||
).raise_for_status()
|
||||
if isinstance(data, dict):
|
||||
httpx.post(
|
||||
url,
|
||||
json=data,
|
||||
headers=headers,
|
||||
files=files,
|
||||
).raise_for_status()
|
||||
else:
|
||||
httpx.post(
|
||||
url,
|
||||
data=data,
|
||||
files=files,
|
||||
headers=headers,
|
||||
).raise_for_status()
|
||||
logger.info(
|
||||
f"Webhook sent to {url}",
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user