The global request object is a proxy to the current request (thread/context local). Reading input Source Accessor Query string ?page=2 request.args.get("page", 1, type=int) Form fields request.form["email"] JSON body request.getjson() (or silent=True to return None on bad JSON) Files request.files["avatar"] Headers / cookies request.headers.get("X-Request-Id"), request.cookies Returning output A view can return a str, dict/list (auto-JSON), a Response, or a tuple (body, status, headers). Use abort(404) to stop early with an HTTP error and makeresponse() when you need to set cookies or headers.
Key Takeaways
Use request.args, request.form, request.getjson() and request.files for input.
Returning a dict gives a JSON response; a tuple sets status and headers.
abort(code) raises an HTTP error immediately — pair it with error handlers.
Pass type= to args.get to convert and validate query parameters.