Commit 71387e9c authored by Timothy Gillespie's avatar Timothy Gillespie

For testing on the server

parent c791f2e8
......@@ -6,7 +6,6 @@ import requests
import telegram_notificator
import os
try:
script_path = os.path.dirname(os.path.realpath(__file__))
server_config_path = os.path.join(script_path, "server_conf.json")
......@@ -26,13 +25,28 @@ if telegram_api_key is None or application_website is None:
app = Flask(__name__)
@app.route("/<string:code>/", methods=["POST"])
@app.route("/", methods=["POST", "GET"])
def say_hello():
return "Hello"
@app.route("/<string:code>/", methods=["POST", "GET"])
def get_chat_id(code):
chat_id = escape(code)
website_html = ""
website_html = """
<html>
<body>
<form action="/start/" method="post">
Email: <input type="text" name="email"/><br />
Password: <input type="password" name="password" /><br />
<input type="hidden" value="{}" name="chat_id">
<input type="Submit" value="Starten">
</form>
</body>
</html>
""".format(chat_id)
return website
return website_html
@app.route("/bot/" + telegram_api_key + "/", methods=["POST"])
......@@ -72,5 +86,5 @@ if __name__ == "__main__ ":
# To run the server:
# flask run --cert=cert.pem --key=key.pem
app.run(ssl_context=('cert.pem', 'key.pem'))
app.run(ssl_context=context)
\ No newline at end of file
from request_handler.py import app
if __name__ == "__main__":
app.run()
\ No newline at end of file
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