コード例 #1
0
ファイル: routes.py プロジェクト: mclaypool/finance_api
from functools import wraps
from flask import Response, request, abort, jsonify
from flask_httpauth import HTTPBasicAuth
from flask_autodoc.autodoc import Autodoc

from MinProd import app
from MinProd.server.controllers.data import DataController
from MinProd.server.controllers.ping import PingController
from MinProd.server.controllers.loan import LoanController
from MinProd.server.controllers.error import ErrorController 
from MinProd.server.controllers.security import SecurityController


# global variables
auth = HTTPBasicAuth()
auto = Autodoc(app)


'''********************************************************************
Public Routes
********************************************************************'''
@app.route('/', methods=['GET'])
@auto.doc(groups=['public'])
def ping():
    '''Route to ping server'''
    try: 
        return PingController.get_ping_json()
    except Exception as e:
        abort(ErrorController.handle_errors(e))

コード例 #2
0
ファイル: main.py プロジェクト: electricjesus/median-ts
    def __init__(self, message, status_code=None, payload=None):
        Exception.__init__(self)
        self.message = message
        if status_code is not None:
            self.status_code = status_code
        self.payload = payload

    def to_dict(self):
        rv = dict(self.payload or ())
        rv['message'] = self.message
        return rv


service = Flask(__name__)
service_auto = Autodoc(service)
data = MedianData()


@service.route('/')
@service.route('/documentation')
def documentation():
    return service_auto.html()


@service.route('/put', methods=['POST'])
@service_auto.doc()
def put_integer():
    """
    takes any integer
    """
コード例 #3
0
# -*- coding: utf-8 -*-

from flask import Blueprint
from flask_autodoc.autodoc import Autodoc

doc = Blueprint("doc", __name__, url_prefix="/v2/docs")
auto = Autodoc()


@doc.route('/')
@doc.route('/public')
def public_doc():
    return auto.html(title="KUAS API Documentation")