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, Notification, NotificationSchema from sqlalchemy.exc import SQLAlchemyError service_blueprint = Blueprint('service...