clean up debugging context
This commit is contained in:
parent
f78fa33397
commit
731b79c865
|
@ -4,7 +4,6 @@ import time
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
|
|
||||||
|
@ -15,8 +14,6 @@ app = Flask(__name__)
|
||||||
app.config.from_pyfile('config.py', silent=True)
|
app.config.from_pyfile('config.py', silent=True)
|
||||||
app.config["JWT_SECRET_KEY"] = os.getenv("JWT_SECRET_KEY")
|
app.config["JWT_SECRET_KEY"] = os.getenv("JWT_SECRET_KEY")
|
||||||
|
|
||||||
#print(app.config["JWT_SECRET_KEY"], file = sys.stderr)
|
|
||||||
|
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
jwt = JWTManager(app)
|
jwt = JWTManager(app)
|
||||||
|
|
||||||
|
@ -120,7 +117,6 @@ def ep_user_post():
|
||||||
_ = user_schema.load({'uuid': u_uuid, 'name': name,
|
_ = user_schema.load({'uuid': u_uuid, 'name': name,
|
||||||
'password': pass_hashed, 'bal_uuid': bal_uuid})
|
'password': pass_hashed, 'bal_uuid': bal_uuid})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file=sys.stderr)
|
|
||||||
return {}, 403
|
return {}, 403
|
||||||
|
|
||||||
u = UserModel(uuid=u_uuid, name=name,
|
u = UserModel(uuid=u_uuid, name=name,
|
||||||
|
@ -136,7 +132,7 @@ def ep_user_post():
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return {}, 403
|
return {}, 403
|
||||||
|
|
||||||
return jsonify(access_token = at, uuid = u.uuid), 200
|
return jsonify(access_token = at), 200
|
||||||
|
|
||||||
@app.route("/user", methods = ["GET"])
|
@app.route("/user", methods = ["GET"])
|
||||||
def ep_user_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}))
|
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"])
|
@app.route("/user", methods = ["DELETE"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
|
@ -312,12 +308,9 @@ def ep_record_post():
|
||||||
r_time = time.strftime("%Y-%m-%d")
|
r_time = time.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
try:
|
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,
|
_ = record_schema.load({'amount': amount, "cat_uuid": category, "uuid": u_uuid,
|
||||||
'user_uuid': current_user['uuid'], 'date': r_time})
|
'user_uuid': current_user['uuid'], 'date': r_time})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file = sys.stderr)
|
|
||||||
return {}, 400
|
return {}, 400
|
||||||
|
|
||||||
r = RecordModel(amount=amount, cat_uuid=category, uuid=u_uuid, user_uuid=current_user['uuid'], date=r_time)
|
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.add(r)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file = sys.stderr)
|
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return {}, 403
|
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)
|
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:
|
except Exception as e:
|
||||||
print(e, file = sys.stderr)
|
|
||||||
return {}, 407
|
return {}, 407
|
||||||
|
|
||||||
return {}, 200
|
return {}, 200
|
||||||
|
|
Loading…
Reference in New Issue