added swagger
This commit is contained in:
@@ -10,7 +10,7 @@ import project.validate.validate as validate
|
|||||||
#import project.models.members as Members
|
#import project.models.members as Members
|
||||||
from project.models.members import Members
|
from project.models.members import Members
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
|
from flasgger import Swagger
|
||||||
|
|
||||||
|
|
||||||
#from models.models import User
|
#from models.models import User
|
||||||
@@ -32,6 +32,25 @@ app.config.from_object("project.config.Config")
|
|||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
app.config['SECRET_KEY'] ='thisisourwondefulkey'
|
app.config['SECRET_KEY'] ='thisisourwondefulkey'
|
||||||
|
|
||||||
|
|
||||||
|
template = {
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"title": "MERMS Core API",
|
||||||
|
"description": "This API was developed using Python Flask, which provides an interface for producing and consuming messages with Apache Kafka topics via HTTP endpoints.",
|
||||||
|
"version": "1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.config['SWAGGER'] = {
|
||||||
|
'title': 'Flask Kafka API',
|
||||||
|
'uiversion': 2,
|
||||||
|
'template': './resources/flasgger/swagger_ui.html'
|
||||||
|
}
|
||||||
|
|
||||||
|
Swagger(app, template=template)
|
||||||
|
|
||||||
|
|
||||||
def token_required(f):
|
def token_required(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated(*args, **kwargs):
|
def decorated(*args, **kwargs):
|
||||||
@@ -247,3 +266,15 @@ def account_payments(current_user):
|
|||||||
}
|
}
|
||||||
return jsonify(payments_data=payments_data)
|
return jsonify(payments_data=payments_data)
|
||||||
##. Description Date Status "10-10-2021 10 AM"
|
##. Description Date Status "10-10-2021 10 AM"
|
||||||
|
|
||||||
|
@app.route("/panel/myproduct/dash")
|
||||||
|
@token_required
|
||||||
|
def myproduct(current_user):
|
||||||
|
dash_data = {
|
||||||
|
"username": "sanyaameye",
|
||||||
|
"account_name": "This is the test account name",
|
||||||
|
"firstname": "TestFirstname",
|
||||||
|
"lastname" : "Testlastname",
|
||||||
|
"email": "bestemail@email.com"
|
||||||
|
}
|
||||||
|
return jsonify(dash_data=dash_data)
|
||||||
@@ -8,3 +8,4 @@ pyjwt
|
|||||||
pillow
|
pillow
|
||||||
flask-cors
|
flask-cors
|
||||||
pandas
|
pandas
|
||||||
|
flasgger
|
||||||
Reference in New Issue
Block a user