This commit is contained in:
2025-09-26 10:46:47 -04:00
parent 9335960d8c
commit c88e1685a1

12
main.py
View File

@@ -1,8 +1,12 @@
from flask import Flask, request
import httpx
import logging
app = Flask(__name__)
# Configure logging
logging.basicConfig(level=logging.INFO)
def populate_webhook_lookup():
lookup = {}
@@ -53,8 +57,16 @@ def convert(uuid):
ghost_payload = request.get_json()
discord_payload = convert_ghost_to_discord(ghost_payload)
try:
r = httpx.post(webhook, json=discord_payload)
if r.status_code == 200:
logging.info(f"Successfully posted to Discord webhook for UUID {uuid}")
else:
logging.warning(f"Discord webhook POST failed for UUID {uuid} with status {r.status_code}: {r.text}")
print(r)
except Exception as e:
logging.error(f"Failed to post to Discord webhook for UUID {uuid}: {str(e)}")
return "error", 500
return "yay"