Code Room
Code reviewMedium
Question
Review this Python Flask resource-creation endpoint.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
@app.route('/api/webhooks', methods=['POST'])def create_webhook(): data = request.get_json() existing = Webhook.query.filter_by(url=data['url']).first() if existing: return jsonify(existing.to_dict()), 200 hook = Webhook(url=data['url'], secret=gen_secret()) db.session.add(hook) db.session.commit() return jsonify(hook.to_dict()), 200Run or narrate your approach, then ask the coach.