Route handler naming (ARCH2004)
Ce contenu n’est pas encore disponible dans votre langue.
Key python.naming.route-handler-naming · Severity info · Category naming
Web framework route handler names should match the semantics of the HTTP verb they serve (GET → get/list, POST → create). Mismatched naming breaks RESTful consistency and makes the code misleading.
Incorrect
Section titled “Incorrect”@app.post("/users")def get_users(payload): # POST but named 'get' return create_user(payload)Correct
Section titled “Correct”@app.post("/users")def create_user(payload): return save_user(payload)Name the handler after its HTTP verb (GET → get/list, POST → create, PUT → update, DELETE → delete).