mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
small refactor
This commit is contained in:
parent
e68e8bb9b9
commit
3aac710a26
@ -991,23 +991,18 @@ def run_workflows(
|
|||||||
f"Error occurred parsing webhook headers: {e}",
|
f"Error occurred parsing webhook headers: {e}",
|
||||||
extra={"group": logging_group},
|
extra={"group": logging_group},
|
||||||
)
|
)
|
||||||
|
files = None
|
||||||
if action.webhook.include_document:
|
if action.webhook.include_document:
|
||||||
with open(document.source_path, "rb") as f:
|
with open(document.source_path, "rb") as f:
|
||||||
files = {
|
files = {
|
||||||
"file": (document.original_filename, f, document.mime_type),
|
"file": (document.original_filename, f, document.mime_type),
|
||||||
}
|
}
|
||||||
httpx.post(
|
httpx.post(
|
||||||
action.webhook.url,
|
action.webhook.url,
|
||||||
data=data,
|
data=data,
|
||||||
files=files,
|
files=files,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
).raise_for_status()
|
||||||
else:
|
|
||||||
httpx.post(
|
|
||||||
action.webhook.url,
|
|
||||||
data=data,
|
|
||||||
headers=headers,
|
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
f"Error occurred sending webhook: {e}",
|
f"Error occurred sending webhook: {e}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user