Tornado allows us to generate responses with any status code that is included in the http.HTTPStatus
dictionary. We might use this dictionary to return easy to understand descriptions as the status codes, such as HTTPStatus.OK
and HTTPStatus.NOT_FOUND
after importing the HTTPStatus
dictionary from the http
module. These names are easy to understand but they don't include the status code number in their description.
We have been working with many different frameworks and micro-frameworks throughout the book, and therefore, we will borrow the code that declares very useful functions and variables related to HTTP status codes from the status.py
file included in Django REST Framework, that is, the framework we have been using in the first chapters. The main advantage of using these variables for the HTTP status codes is that their names include both the number and the description. When we read the code, we will understand the status code number and their...