December 2018
Intermediate to advanced
500 pages
12h 33m
English
Now, we will create a NotificationManager class that we will use to persist the NotificationModel instances in an in-memory dictionary. Our API methods will call methods for the NotificationManager class to retrieve, insert, update, and delete NotificationModel instances. Create a new service.py file in the service folder. The following lines show the code that creates a NotificationManager class in the service/service.py file. In addition, the following lines declare all the imports we will need for all the code we will write in this file. The code file for the sample is included in the restful_python_2_01_01 folder, in the Flask01/service/service.py file:
from flask import Flask from flask_restful import ...