-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
36 lines (25 loc) · 704 Bytes
/
server.py
File metadata and controls
36 lines (25 loc) · 704 Bytes
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
from flask import request, jsonify
from Telegram import Telegram
from main import app, db
import requests
@app.route('/', methods=['POST'])
def post_route():
data = request.get_json()
telegram.handle_request(data)
resp = jsonify(success=True)
return resp
@app.route('/', methods=['GET'])
def get_route():
return "<h1> App is running </h1>"
@app.route('/reset', methods=['GET'])
def create_db():
db.drop_all()
db.session.commit()
db.create_all()
db.session.commit()
return "<h1> DB Recreated</h1>"
telegram = Telegram()
if __name__ == '__main__':
telegram.set_webhook('https://8df96f0dad55.ngrok.io')
print("App running")
app.run(debug=True)