"magic_pdf/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "27883619f51a8e043ccc2ef17e50b46240451869"
Unverified Commit d69dfb7c authored by changchiyou's avatar changchiyou
Browse files
parent 0b62bbb5
import json import json
import requests import requests
from config import VERSION, WEBUI_FAVICON_URL, WEBUI_NAME from config import VERSION, WEBUI_FAVICON_URL, WEBUI_NAME
def post_webhook(url: str, message: str, event_data: dict) -> bool: def post_webhook(url: str, message: str, event_data: dict) -> bool:
try: try:
payload = {} payload = {}
if "https://hooks.slack.com" in url: # Slack and Google Chat Webhooks
if "https://hooks.slack.com" in url or "https://chat.googleapis.com" in url:
payload["text"] = message payload["text"] = message
# Discord Webhooks
elif "https://discord.com/api/webhooks" in url: elif "https://discord.com/api/webhooks" in url:
payload["content"] = message payload["content"] = message
# Microsoft Teams Webhooks
elif "webhook.office.com" in url: elif "webhook.office.com" in url:
action = event_data.get("action", "undefined") action = event_data.get("action", "undefined")
facts = [ facts = [
...@@ -33,6 +34,7 @@ def post_webhook(url: str, message: str, event_data: dict) -> bool: ...@@ -33,6 +34,7 @@ def post_webhook(url: str, message: str, event_data: dict) -> bool:
} }
], ],
} }
# Default Payload
else: else:
payload = {**event_data} payload = {**event_data}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment