From 731b79c865b6f70b83316835ede980774845ee25 Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Sun, 29 Dec 2024 18:25:30 +0200 Subject: [PATCH] clean up debugging context --- app/__init__.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 2b4d118..968c871 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -4,7 +4,6 @@ import time import json import uuid import datetime -import sys import os from hashlib import sha256 @@ -15,8 +14,6 @@ app = Flask(__name__) app.config.from_pyfile('config.py', silent=True) app.config["JWT_SECRET_KEY"] = os.getenv("JWT_SECRET_KEY") -#print(app.config["JWT_SECRET_KEY"], file = sys.stderr) - db = SQLAlchemy(app) jwt = JWTManager(app) @@ -120,7 +117,6 @@ def ep_user_post(): _ = user_schema.load({'uuid': u_uuid, 'name': name, 'password': pass_hashed, 'bal_uuid': bal_uuid}) except Exception as e: - print(e, file=sys.stderr) return {}, 403 u = UserModel(uuid=u_uuid, name=name, @@ -136,7 +132,7 @@ def ep_user_post(): db.session.rollback() return {}, 403 - return jsonify(access_token = at, uuid = u.uuid), 200 + return jsonify(access_token = at), 200 @app.route("/user", methods = ["GET"]) def ep_user_get(): @@ -154,7 +150,7 @@ def ep_user_get(): at = create_access_token(identity = json.dumps({'uuid': u.uuid, 'bal_uuid': u.bal_uuid})) - return jsonify(access_token = at, uuid = u.uuid), 200 + return jsonify(access_token = at), 200 @app.route("/user", methods = ["DELETE"]) @jwt_required() @@ -312,12 +308,9 @@ def ep_record_post(): r_time = time.strftime("%Y-%m-%d") try: - #_ = record_schema.load(amount=amount, cat_uuid=category, uuid=u_uuid, - # user_uuid=current_user['uuid'], date=datetime.datetime.now()) _ = record_schema.load({'amount': amount, "cat_uuid": category, "uuid": u_uuid, 'user_uuid': current_user['uuid'], 'date': r_time}) except Exception as e: - print(e, file = sys.stderr) return {}, 400 r = RecordModel(amount=amount, cat_uuid=category, uuid=u_uuid, user_uuid=current_user['uuid'], date=r_time) @@ -338,7 +331,6 @@ def ep_record_post(): db.session.add(r) db.session.commit() except Exception as e: - print(e, file = sys.stderr) db.session.rollback() return {}, 403 @@ -360,7 +352,6 @@ def ep_balance_up(): BalanceModel.metadata.tables.get("balance").update().where(BalanceModel.metadata.tables.get("balance").c.uuid == current_user['bal_uuid']).values(value = v + amount) except Exception as e: - print(e, file = sys.stderr) return {}, 407 return {}, 200