From 27b58e9c62cc1f96744d5361721ea469aa27b507 Mon Sep 17 00:00:00 2001 From: IgorL123 Date: Tue, 22 Aug 2023 14:04:23 +0300 Subject: [PATCH 1/3] fix --- db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.py b/db.py index 43d3b4f..3816b95 100644 --- a/db.py +++ b/db.py @@ -50,5 +50,5 @@ def query_change(x): def close(cur): - cursor.close() + cur.close() From 5f8da4d34a6912e1976ada57ea5da253d2c648ae Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 22 Aug 2023 23:03:31 +0300 Subject: [PATCH 2/3] refactoring --- .gitignore | 3 ++- api_functions.py | 2 +- app.py | 21 ++++++++------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 6b638aa..35153a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ venv setiings.json -.vscode \ No newline at end of file +.vscode +__pycache__ \ No newline at end of file diff --git a/api_functions.py b/api_functions.py index 285d3ff..826800c 100644 --- a/api_functions.py +++ b/api_functions.py @@ -23,4 +23,4 @@ def isEnd(cur, trueChatID): elif m >= len(roles) - m: return "mafia" - return "" + return None diff --git a/app.py b/app.py index 5361a26..9fab54d 100644 --- a/app.py +++ b/app.py @@ -15,8 +15,8 @@ def action(): # put application's code here checkedUserID = data['CheckedUserID'] response = { - "killedUserId": "", - "isEndGame": "", + "killedUserId": None, + "isEndGame": None, "checkedRole": False } @@ -40,22 +40,17 @@ def action(): # put application's code here return jsonify(response), 200 -@app.route('/create_game', methods=["POST"]) +@app.route('/create_chat', methods=["POST"]) def create(): - TCI = request.json['chatID'] + tci = request.json['chatID'] cursor = db.connection.cursor() - db.query_ins_chat(TCI, cursor) - db.close(cursor) + db.query_ins_chat(tci, cursor) + return 'ok', 200 -@app.route('/start_game') +@app.route('/start_game', methods=["POST"]) def start(): # Команда принимает на вход - pass - - -@app.route('/action') -def action(): - pass + return '', 501 if __name__ == '__main__': From 67e36a4a8d68efabf18ccf7f5e3f7525c2da2893 Mon Sep 17 00:00:00 2001 From: IgorL123 Date: Tue, 22 Aug 2023 23:13:23 +0300 Subject: [PATCH 3/3] test pr --- app.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 9fab54d..e912eec 100644 --- a/app.py +++ b/app.py @@ -54,4 +54,4 @@ def start(): # Команда принимает на вход if __name__ == '__main__': - app.run() + app.run(host="0.0.0.0", debug=True) diff --git a/requirements.txt b/requirements.txt index b8dc338..fae349d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,5 @@ Flask==2.3.2 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.3 -psycopg2==2.9.7 +psycopg2-binary==2.9.7 Werkzeug==2.3.7