Code Room
Code reviewMediumcr-g133
Subject Contract violationsLevel Mid–Senior~22 minCommon in Networking & APIs interviewsIndustries Software development

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.

Talk through your review
Code to reviewpython
@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()), 200
Run or narrate your approach, then ask the coach.