Spaces:
Sleeping
Sleeping
Commit
•
e1a0fa1
1
Parent(s):
5bbb1ee
Update app.py
Browse files
app.py
CHANGED
@@ -2,23 +2,29 @@ import flask
|
|
2 |
from flask import request, jsonify
|
3 |
import os
|
4 |
from dotenv import load_dotenv
|
5 |
-
|
6 |
load_dotenv()
|
7 |
|
8 |
app = flask.Flask(__name__, template_folder="./")
|
9 |
|
|
|
10 |
@app.route('/')
|
11 |
def index():
|
12 |
return flask.render_template('index.html')
|
13 |
|
|
|
14 |
@app.route("/avp", methods=["POST"])
|
15 |
def avp():
|
16 |
incoming = request.get_json()
|
17 |
print(incoming)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
datas = incoming.get("bazis", {})
|
20 |
-
|
21 |
-
return jsonify(datas)
|
22 |
|
23 |
if __name__ == '__main__':
|
24 |
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|
|
|
2 |
from flask import request, jsonify
|
3 |
import os
|
4 |
from dotenv import load_dotenv
|
|
|
5 |
load_dotenv()
|
6 |
|
7 |
app = flask.Flask(__name__, template_folder="./")
|
8 |
|
9 |
+
|
10 |
@app.route('/')
|
11 |
def index():
|
12 |
return flask.render_template('index.html')
|
13 |
|
14 |
+
|
15 |
@app.route("/avp", methods=["POST"])
|
16 |
def avp():
|
17 |
incoming = request.get_json()
|
18 |
print(incoming)
|
19 |
+
|
20 |
+
# Получаем входной JSON-объект из параметра "bazis"
|
21 |
+
datas = incoming["bazis"]
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
# Возвращаем словарь с обновленными значениями в параметре "bazis_out"
|
26 |
+
return jsonify({"bazis_out": datas})
|
27 |
|
|
|
|
|
|
|
28 |
|
29 |
if __name__ == '__main__':
|
30 |
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|