Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the framework flask_restful by flask-smorest cause is depreca…
- Loading branch information
Showing
5 changed files
with
31 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
from typing import Dict, List | ||
|
||
from flask_restful import Resource | ||
from flask.views import MethodView | ||
from flask_smorest import Blueprint | ||
|
||
from .models import CharacterModel | ||
|
||
blueprint_characters = Blueprint( | ||
"characters", "characters", url_prefix="/characters", description="Operations on characters" | ||
) | ||
|
||
class Characters(Resource): | ||
|
||
@blueprint_characters.route("/") | ||
class Characters(MethodView): | ||
def get(self) -> Dict[str, List]: | ||
characters = CharacterModel.query.all() | ||
return {"characters": [character.json() for character in characters]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from typing import Dict, List | ||
|
||
from flask_restful import Resource | ||
from flask.views import MethodView | ||
from flask_smorest import Blueprint | ||
|
||
from .models import EpisodeModel | ||
|
||
blueprint_episodes = Blueprint("episodes", "episodes", url_prefix="/episodes", description="Operations on episodes") | ||
|
||
class Episodes(Resource): | ||
|
||
@blueprint_episodes.route("/") | ||
class Episodes(MethodView): | ||
def get(self) -> Dict[str, List]: | ||
episodes = EpisodeModel.query.all() | ||
return {"episodes": [episode.json() for episode in episodes]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
Flask==2.0.2 | ||
Flask-RESTful==0.3.9 | ||
flask-smorest==0.35.0 | ||
gunicorn==20.1.0 | ||
safety==1.10.3 | ||
pytest==6.2.5 | ||
Flask-SQLAlchemy==2.5.1 | ||
PyMySQL==1.0.2 | ||
# SQLAlchemy==1.4.27 | ||
## The following requirements were added by pip freeze: | ||
aniso8601==9.0.1 | ||
apispec==5.1.1 | ||
attrs==21.2.0 | ||
certifi==2021.10.8 | ||
charset-normalizer==2.0.7 | ||
click==8.0.3 | ||
dparse==0.5.1 | ||
Flask-RESTful==0.3.9 | ||
greenlet==1.1.2 | ||
idna==3.3 | ||
iniconfig==1.1.1 | ||
itsdangerous==2.0.1 | ||
Jinja2==3.0.3 | ||
MarkupSafe==2.0.1 | ||
marshmallow==3.14.1 | ||
packaging==21.2 | ||
pluggy==1.0.0 | ||
py==1.11.0 | ||
pyparsing==2.4.7 | ||
pytz==2021.3 | ||
PyYAML==6.0 | ||
requests==2.26.0 | ||
safety==1.10.3 | ||
six==1.16.0 | ||
SQLAlchemy==1.4.27 | ||
toml==0.10.2 | ||
urllib3==1.26.7 | ||
webargs==8.0.1 | ||
Werkzeug==2.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
Flask==2.0.2 | ||
Flask-RESTful==0.3.9 | ||
flask-smorest==0.35.0 | ||
gunicorn==20.1.0 | ||
safety==1.10.3 | ||
pytest==6.2.5 | ||
Flask-SQLAlchemy==2.5.1 | ||
PyMySQL==1.0.2 |