October 2016
Intermediate to advanced
418 pages
9h 52m
English
Neither Flask nor Flask-RESTful includes the declaration of variables for the different HTTP status codes. We don't want to return numbers as status codes. We want our code to be easy to read and understand, and therefore, we will use descriptive HTTP status codes. We will borrow the code that declares 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 preceding chapters.
First, create a folder named api within the root folder for the recently created virtual environment, and then create a new status.py file within the api folder. The following lines show the code that declares functions and ...