File size: 1,455 Bytes
5d67131 6d854f4 5d67131 6d854f4 5d67131 6d854f4 5d67131 6d854f4 5d67131 6d854f4 5d67131 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
from flask import Flask, request, render_template_string
import requests
import json
app = Flask(__name__)
# HTML ํ
ํ๋ฆฟ
HTML_TEMPLATE = '''
<!DOCTYPE html>
<html>
<head>
<title>์ด๋ฉ์ผ ์ ์ก</title>
<meta charset="utf-8">
</head>
<body>
<h1>์ด๋ฉ์ผ ์นํ
์ ์ก</h1>
<form method="POST">
<input type="email" name="email" placeholder="์ด๋ฉ์ผ ์ฃผ์ ์
๋ ฅ" required>
<input type="submit" value="์ ์ก">
</form>
{% if result %}
<p>{{ result }}</p>
{% endif %}
</body>
</html>
'''
@app.route('/', methods=['GET', 'POST'])
def home():
result = None
if request.method == 'POST':
email = request.form['email']
webhook_url = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjYwNTZmMDYzMDA0M2M1MjZiNTUzMzUxMzUi_pc"
try:
response = requests.post(webhook_url, json={"email": email})
if response.status_code == 200:
try:
result = f"์ฑ๊ณต!\n{json.dumps(response.json(), indent=2, ensure_ascii=False)}"
except:
result = f"์ฑ๊ณต!\n{response.text}"
else:
result = f"์ค๋ฅ: {response.status_code}\n{response.text}"
except Exception as e:
result = f"์ค๋ฅ ๋ฐ์: {str(e)}"
return render_template_string(HTML_TEMPLATE, result=result)
if __name__ == '__main__':
app.run(debug=True, port=7860) |