Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
debug logging
  • Loading branch information
LucifersCircle committed Dec 5, 2024
1 parent d44eeb0 commit bc9a88f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@ def add_key():
if not key:
return jsonify({'error': 'Key is required'}), 400
try:
print(f"Received key: {key}")
encrypted_key = cipher.encrypt(key.encode())
print(f"Encrypted key: {encrypted_key}")
conn = sqlite3.connect(DB_FILE)
print("Database connection established.")
conn.execute('INSERT INTO keys (encrypted_key) VALUES (?)', (encrypted_key,))
conn.commit()
conn.close()
print("Key inserted successfully.")
return jsonify({'message': 'Key added successfully'}), 201
except Exception as e:
print(f"Error adding key: {e}")
return jsonify({'error': str(e)}), 500

if __name__ == '__main__':
Expand Down

0 comments on commit bc9a88f

Please sign in to comment.