Combining blueprints with resourceful routing

Now, we will create the resources that compose our main building blocks for the RESTful API. First, we will create a few instances that we will use in the different resources. Create a new views.py file within the services folder and add the following lines. Notice that the code imports the HttpStatus enum declared in the http_status.py module that we created in the previous chapter. The code file for the sample is included in the restful_python_2_02_01 folder, in the Flask01/service/views.py file:

from flask import Blueprint, request, jsonify, make_response from flask_restful import Api, Resource from http_status import HttpStatus from models import orm, NotificationCategory, NotificationCategorySchema, ...

Get Hands-On RESTful Python Web Services - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.