December 2018
Intermediate to advanced
500 pages
12h 33m
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. Specifically, we will take advantage of the support for enumerations added in Python 3.4 to declare a class that defines unique sets of names and values that represent the different HTTP status codes.
First, create a service folder within the root folder for the recently created virtual environment. Create a new http_status.py file within the service folder. The following lines show the code that declares the HttpStatus ...
Read now
Unlock full access