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,
|
max_retries=3,
|
||||||
throws=(httpx.HTTPError,),
|
throws=(httpx.HTTPError,),
|
||||||
)
|
)
|
||||||
def send_webhook(url, data, headers, files):
|
def send_webhook(url: str, data: dict | str, headers: dict, files: dict | None):
|
||||||
try:
|
try:
|
||||||
httpx.post(
|
if isinstance(data, dict):
|
||||||
url,
|
httpx.post(
|
||||||
data=data,
|
url,
|
||||||
files=files,
|
json=data,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
).raise_for_status()
|
files=files,
|
||||||
|
).raise_for_status()
|
||||||
|
else:
|
||||||
|
httpx.post(
|
||||||
|
url,
|
||||||
|
data=data,
|
||||||
|
files=files,
|
||||||
|
headers=headers,
|
||||||
|
).raise_for_status()
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Webhook sent to {url}",
|
f"Webhook sent to {url}",
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user