From 84a1ed15f5b0bb89f0912f061d19ffab2050bdb4 Mon Sep 17 00:00:00 2001 From: Swapnil Date: Tue, 30 Jan 2024 21:51:11 +0530 Subject: [PATCH] app: fix --- database/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database/main.py b/database/main.py index 700e5a0..f142281 100644 --- a/database/main.py +++ b/database/main.py @@ -54,7 +54,9 @@ def create_token(): # API to get the token based on the id @app.route('/token/', methods=['GET']) def get_token_by_id(id): - token = Token.query.get_or_404(id) + token = Token.query.get(id) + if not token: + return jsonify({'error': 'Token not found'}), 404 token_info = { 'id': token.id, 'email': token.email,