|
from flask import Flask, request, render_template_string |
|
import requests |
|
import json |
|
|
|
app = Flask(__name__) |
|
|
|
|
|
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) |