Skip to main content

API implementation in the Python Flask Web Application Framework


Flask is a lightweight web application framework based on Python. The Flask framework only supply the core components of a web applications and leaves the remaining design and architecture level decisions to the developer.

This is my study note on how to extend how to extend a web application with an application programming interface (or API) . REST (REpresentational State Transfer) is one of the standard architectural design for web services and web APIs.







he following example is based on Flask Mega Tutorial . There is a section dedicated for implementing API for a web application. 

The quick start section of the flask_resful library provides explanation for the following modules. 
  • Resource
  • reqparse - provide simple and uniform access to any variable on the flask.request object in Flask


- Flask
    - https://en.wikipedia.org/wiki/Flask_(web_framework)
- BluePrint 
- Namespace
    - asd
- the flask_resful library, Flask-restplus, and Flask-RestX
- 





- https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xxiii-application-programming-interfaces-apis
- https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xxiii-application-programming-interfaces-apis

- https://blog.miguelgrinberg.com/post/writing-a-javascript-rest-client
- https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
- https://blog.miguelgrinberg.com/post/writing-a-javascript-rest-client
- https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask


Flask Mega Tutorial








Comments

Popular posts from this blog

Web App Scaling with Flask Blueprint and Namespaces

A real-world Flask-RESTX-based API  may have multiple namespaces. The best practice for scaling a web application is to use a blueprint along with multiple namespace. The namespace is used to group a set of CRUD operations for a specific resource.  Blueprint can be used to combine (mixing) multiple namespaces. Here’s an example directory structure: project\ ├── app.py # Application file ├── apis #    ├── v20 # API directory    │   ├── __init__.py    │   ├── specs.py # API namespaces and REST methods    │   ├── steps.py # API namespaces and REST methods    └── v20bp.py # API blueprint file Here is an example app.py. Using a blue print allow you to mount your API on any url prefix. from flask import Flask from apis.v20bp import blueprint as api app = ...