Add ApiDoc support to Flask
Project description
Flask ApiDoc Extend
Flask ApiDoc Extend is a Flask extension which adds support for the ApiDoc.
Features
- Host apidoc's files, by default they are hosted in http://localhost:5000/apidoc
Installation
You need to install apidoc first.
$ npm install apidoc -g
Then you can install flask-apidoc via Python Package Index (PyPI)
$ pip install flask-apidoc-extend
Usage
Creates a apidoc.json file under your project.
yourproject/apidoc.json
like this:
{
"name": "Flask REST API Doc",
"version": "1.0.0",
"description": "A Flask REST API Doc example",
"title": "A Flask REST API Doc example",
"url" : "http://localhost:5000"
}
Initalizes Apidoc and pass your flask app to it.
Initializes a new instance of ApiDoc.
:param Input_path: source dirname. Location of your project files.
:param output_path: Output dirname. Location where to put to generated documentation.default is 'static/docs'
:param template_path:Use template for output files. You can create and use your own template.
:param app: your flask instence
:param mount: register blueprint of the apidoc files to your flask application.then you can access
:param url_path: The url path for the apidoc files.default is 'apidoc'
:param private Include private APIs in output.
example:
app = Flask(__name__)
ApiDoc(app=app)
Add some apidoc comments anywhere in your source code:
"""
@api {get} /user/:id Request User information
@apiName GetUser
@apiGroup User
@apiParam {Number} id User's unique ID.
@apiSuccess {String} firstname Firstname of the User.
@apiSuccess {String} lastname Lastname of the User.
"""
Then cd
to your project to generate the documentation
$ flask apidoc
Now run
$ flask run
You can access your doc files by http://127.0.0.1:5000/apipdoc
Feedback
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Flask-Apidoc-Extend-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba2289c4a71806501386db7e216ab77a2235f494d615056564e9e71382294583 |
|
MD5 | 60388deb9b26b39634457f2760bc090b |
|
BLAKE2b-256 | fb9e3afca7046205a29588cb1be59825243f18325c71739d868858b06cf82710 |
Hashes for Flask_Apidoc_Extend-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6d34eda88b079f062ef1711a575491a9aacbe9f5b93ad1ef8b5ea7b4d6d137 |
|
MD5 | f1fc7fd78df7842ce491543e2872a728 |
|
BLAKE2b-256 | 8b7f6ed78d58faf7e40dabd70ef79bd33da54b5b4a0f8dbb60cb83aef8fc123e |