Improved logging
This commit is contained in:
@@ -6,7 +6,7 @@ from flask import request, render_template
|
|||||||
from requests import post, get
|
from requests import post, get
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
from traceback import format_exc
|
||||||
def validate_turnstile(response: str, ip: str) -> bool:
|
def validate_turnstile(response: str, ip: str) -> bool:
|
||||||
turnstile_secret = environ['TURNSTILE_SECRET']
|
turnstile_secret = environ['TURNSTILE_SECRET']
|
||||||
cf_response = post(
|
cf_response = post(
|
||||||
@@ -25,8 +25,8 @@ def validate_turnstile(response: str, ip: str) -> bool:
|
|||||||
def send_to_discord(form: dict) -> bool:
|
def send_to_discord(form: dict) -> bool:
|
||||||
try:
|
try:
|
||||||
discord_hook = environ['DISCORD_WEBHOOK']
|
discord_hook = environ['DISCORD_WEBHOOK']
|
||||||
except KeyError as e:
|
except KeyError:
|
||||||
app.logger.error(e.with_traceback())
|
app.logger.error(format_exc())
|
||||||
return False
|
return False
|
||||||
discord_msg = dedent(
|
discord_msg = dedent(
|
||||||
f'''
|
f'''
|
||||||
|
Reference in New Issue
Block a user