Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def generate_exception():
@app.route('/user/<username>')
def user_profile(username):
print(f"User profile requested for {username}")
test = user_data[username]
if not test:
raise
return jsonify({"message": f"Profile for {username}", "data": test})
user_info = user_data.get(username)
if user_info is None:
return jsonify({"error": f"User '{username}' not found"}), 404
return jsonify({"message": f"Profile for {username}", "data": user_info})

@app.route('/process', methods=['POST'])
def process_user_data():
Expand Down Expand Up @@ -154,4 +154,4 @@ def user_stats(username):
})

if __name__ == '__main__':
app.run('0.0.0.0', 8010)
app.run('0.0.0.0', 8010)