Hi Below is my running code , can be accessed with below URL: http://127.0.0.1:5000/api/documentation
from flask import Flask, Blueprint
from flask_restplus import Api, Resource, fields
app = Flask(__name__)
blueprint = Blueprint('api', __name__, url_prefix='/api')
api = Api(blueprint, doc='/documentation') #,doc=False
app.register_blueprint(blueprint)
app.config['SWAGGER_UI_JSONEDITOR'] = True
login_details = api.model('LoginModel',{'user_name' : fields.String('The Username.'),'pass_word' : fields.String('The password.'),})
# pass_word = api.model('Pwd', {'pass_word' : fields.String('The password.')})
credentials = []
python = {'user_name' : '1234','pwd':'23213413'}
credentials.append(python)
@api.route('/login')
class Language(Resource):
@api.marshal_with(login_details, envelope='the_data',mask='pass_word')
def get(self):
return credentials
@api.expect(login_details)
@api.marshal_with(login_details, envelope='the_data',mask='pass_word')
def post(self):
login_details = api.payload
print(login_details)
login_details['id'] = len(credentials) + 1
credentials.append(login_details)
return {'result' : 'credentials added'}, 201
if __name__ == '__main__':
app.run(debug=True)
Can you please tell what should i do to to hide the password with ***** when i entering on the swagger UI , and value should be passed to the argument correctly.