Flask Swagger Documentation by Problem Fighter Library
Project description
In the name of God, the Most Gracious, the Most Merciful.
PF-Flask-Swagger
PF Flask Swagger is created from produce Swagger API Documentation very quickly and easily.
pip install Flask
- Install PF Flask Swagger
pip install -U PF-Flask-Swagger
- Create file called quickstart.py and add below codes
from flask import Flask, redirect
from marshmallow import fields
from pf_flask_swagger.swagger.pf_swagger_decorator import post_request, post_upload_request
from pf_flask_swagger.flask.pf_flask_swagger import PFFlaskSwagger
from pf_flask_rest_com.api_def import FileField, APIDef
app = Flask(__name__)
flask_swagger = PFFlaskSwagger(app)
class PersonDTO(APIDef):
first_name = fields.String(required=True, error_messages={"required": "Please enter first name"})
last_name = fields.String(allow_none=None)
email = fields.Email(required=True, error_messages={"required": "Please enter email."})
income = fields.Float(allow_none=None)
image = FileField(allow_none=None)
@app.route('/')
def bismillah():
return redirect("/pf-flask-swagger-ui")
@app.route('/post-request')
@post_request(request_obj=PersonDTO, response_list=PersonDTO)
def post_request_endpoint():
return "PF Flask Swagger POST Request"
@app.route('/post-upload-request')
@post_upload_request(request_obj=PersonDTO)
def post_upload_request():
return "PF Flask Swagger File Upload Request"
if __name__ == '__main__':
app.run()
- Now run the Flask application.
Documentation
Install and update using pip:
pip install -U PF-Flask-Swagger
Please find the Documentation with example from hmtmcse.com
Donate
Problem Fighter develops and supports PF-Flask-Swagger and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects.
Contributing
For guidance on setting up a development environment and how to make a contribution to PF-Flask-Swagger, see the contributing guidelines.
Links
- Changes : https://opensource.problemfighter.org/flask/pf-flask-swagger
- PyPI Releases : https://pypi.org/project/pf-flask-swagger
- Source Code : https://github.com/problemfighter/pf-flask-swagger
- Issue Tracker : https://github.com/problemfighter/pf-flask-swagger/issues
- Website : https://www.problemfighter.com/open-source
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PF-Flask-Swagger-1.0.2.tar.gz
(14.0 kB
view hashes)
Built Distribution
Close
Hashes for PF_Flask_Swagger-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85bbe96792eedbfc877a2343a7a8410030c75ae6dd37b24d1121deacbc5b5181 |
|
MD5 | bdeb6a01db42f0dd7d517321fa2ab1e0 |
|
BLAKE2b-256 | 57b4e862c0f34699d5e3c9cb461571f4ac414e48fc33e80bb25942b5c8f57bb1 |