Swapnil-101 commited on
Commit
e26a412
·
verified ·
1 Parent(s): 8af33a6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -0
main.py CHANGED
@@ -423,7 +423,19 @@ def select_mentor():
423
  except sqlite3.IntegrityError:
424
  return jsonify({"message": "Failed to select mentor"}), 500
425
 
 
 
 
 
 
 
 
 
426
 
 
 
 
 
427
  @app.route('/users', methods=['GET'])
428
  def get_all_users():
429
  try:
 
423
  except sqlite3.IntegrityError:
424
  return jsonify({"message": "Failed to select mentor"}), 500
425
 
426
+ @app.route('/get_all_mentors', methods=['POST'])
427
+ def get_all_mentors():
428
+ try:
429
+ with open("mentor.txt", "r") as file:
430
+ mentors = file.readlines()
431
+
432
+ if not mentors:
433
+ return jsonify({"message": "No mentors"}), 404
434
 
435
+ return jsonify({"mentors": mentors}), 200
436
+ except Exception as e:
437
+ return jsonify({"message": f"Failed to retrieve mentors: {str(e)}"}), 500
438
+
439
  @app.route('/users', methods=['GET'])
440
  def get_all_users():
441
  try: