flask-restplus

Move Flask-Restplus Swagger API Docs

浪尽此生 提交于 2019-12-06 00:37:21
I'm trying to use flask-restplus to build a restful API in python. I'd like to have the swagger docs located in a different place than the normal "/". I'm following the documentation here and have followed the instructions. I'm using python2.7.3 and have the following code ~/dev/test/app.py : from flask import Flask from flask.ext.restplus import Api, apidoc app = Flask(__name__) api = Api(app, ui=False) @api.route('/doc/', endpoint='doc') def swagger_ui(): return apidoc.ui_for(api) app.register_blueprint(apidoc.apidoc) When I try to run this python app.py I get: Traceback (most recent call

With Flask-Restplus how to create a POST api without making the URL same with GET

旧巷老猫 提交于 2019-12-02 09:38:06
I'm new to Flask and Flask-RestPlus. I'm creating a web api where I want keep my POST urls different from the GET urls which are visible in Swagger. For example in Flask-Restplus @api.route('/my_api/<int:id>') class SavingsModeAction(Resource): @api.expect(MyApiModel) def post(self): pass #my code goes here def get(self, id): pass #my code goes here So in swagger for the both apis url would look like GET: /my_api/{id} POST: /my_api/{id} But so far I have absolutely no use of {id} part in my post api and it perhaps creates a bit of confusion for an user whether to update an existing record or

With Flask-Restplus how to create a POST api without making the URL same with GET

喜你入骨 提交于 2019-12-01 13:06:59
问题 I'm new to Flask and Flask-RestPlus. I'm creating a web api where I want keep my POST urls different from the GET urls which are visible in Swagger. For example in Flask-Restplus @api.route('/my_api/<int:id>') class SavingsModeAction(Resource): @api.expect(MyApiModel) def post(self): pass #my code goes here def get(self, id): pass #my code goes here So in swagger for the both apis url would look like GET: /my_api/{id} POST: /my_api/{id} But so far I have absolutely no use of {id} part in my