Handling requests and responses (Simple)
This section will demonstrate how Flask handles incoming data on HTTP requests and how you can send responses.
Set aside the scheduling application and open a new Python file to explore Flask.
How to do it...
- At the core, Flask and Werkzeug provide request and response objects to represent incoming and outgoing data for your web application. Flask provides three different patterns for return values from your view functions:
- string, which can optionally use a template engine (introduced later)
- a response instance, an object with attributes representing HTTP response details
- tuple of
(string, status, http_headers), for convenience, such that you do not have to create a response ...