当前位置: 首页>>代码示例>>Python>>正文


Python Api.add_namespace方法代码示例

本文整理汇总了Python中flask_restplus.Api.add_namespace方法的典型用法代码示例。如果您正苦于以下问题:Python Api.add_namespace方法的具体用法?Python Api.add_namespace怎么用?Python Api.add_namespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_restplus.Api的用法示例。


在下文中一共展示了Api.add_namespace方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Flask

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from flask import Flask
from flask_restplus import Api

from .version import api as version_ns
from .gpio import api as gpio_ns
from .spi import api as spi_ns

# Can't use distribution name in python 3.4.0
# https://github.com/mitsuhiko/flask/issues/1011
app = Flask(__name__)
api = Api(app, endpoint='api', prefix='/api', doc='/api',
          version='0.1',
          title='raspberry-api-server',
          description='RESTful interface to Raspberry Pi')

api.add_namespace(version_ns)
api.add_namespace(gpio_ns)
api.add_namespace(spi_ns)

def run(*args, **kwargs):
    import os
    if os.environ.get('DEBUG'):
        app.config['DEBUG'] = True
    app.run(*args, **kwargs)

开发者ID:uSpike,项目名称:raspberry-api-server,代码行数:26,代码来源:app.py

示例2: Blueprint

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from flask import Blueprint
from flask_restplus import Api
from .user import api as user_api
from .quote import api as quote_api
from .track import api as track_api
from .book import api as book_api
from .lookup import api as lookup_api
from .update import api as update_api
from .orders import api as orders_api
from .contact import api as contact_api
from .roles import api as roles_api

blueprint = Blueprint('api', __name__)
api = Api(blueprint,
          title='Packr',
          version='0.0.1',
          description='For sending packages')
api.add_namespace(user_api)
api.add_namespace(quote_api)
api.add_namespace(track_api)
api.add_namespace(book_api)
api.add_namespace(lookup_api)
api.add_namespace(update_api)
api.add_namespace(orders_api)
api.add_namespace(contact_api)
api.add_namespace(roles_api)
开发者ID:KnightHawk3,项目名称:packr,代码行数:28,代码来源:__init__.py

示例3: Blueprint

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
"""Main module managing views."""

# from flask import Blueprint
from flask_restplus import Api

from .views_admin import ns as ns_admin
# from .views_core import ns as ns_core
from .views_core import bp


authorizations = {
    'ApiKey': {
        'type': 'apiKey',
        'in': 'header',
        'name': 'authentication-token'
    }
}
# bp = Blueprint('stuffrapi', __name__, template_folder='templates')
api = Api(bp, authorizations=authorizations, security='ApiKey')
# api.add_namespace(ns_core)
api.add_namespace(ns_admin)
开发者ID:BitLooter,项目名称:Stuffr-backend,代码行数:23,代码来源:views.py

示例4: Blueprint

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from flask import Blueprint
from flask_restplus import Api

from .endpoints import predict_ns

blueprint = Blueprint('predict', __name__, url_prefix='/api/v1.0')
# v1_0 = Blueprint('v1_0', __name__, url_prefix='/api/v1.0')
api = Api(
    blueprint, version='1.0', title='{{cookiecutter.project_name}}',
    description='{{cookiecutter.project_name}} Prediction API', doc='/doc/')

api.namespaces.clear()
api.add_namespace(predict_ns)
开发者ID:gbourdin,项目名称:charlas,代码行数:15,代码来源:__init__.py

示例5: Flask

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from .resources.requests import ns as requests_ns
from .resources.comments import ns as comments_ns
from .resources.movies import ns as movies_ns
from .resources.tvshows import ns as tvshows_ns
from .model.database import db

app = Flask(__name__,
    static_url_path = '',
    static_folder   = config['STATIC_FOLDER'])

blueprint = Blueprint('api', __name__)
api = Api(blueprint,
    title    = 'Plex Requests API',
    validate = True)

api.add_namespace(requests_ns)
api.add_namespace(comments_ns)
api.add_namespace(movies_ns)
api.add_namespace(tvshows_ns)

app.register_blueprint(blueprint, url_prefix='/api')

@app.route('/')
def index():
    return redirect('/index.html')

def run():
    with app.app_context():
        db.initialize()

    app.run(
开发者ID:ccl2of4,项目名称:plex-requests-api,代码行数:33,代码来源:__init__.py

示例6: Api

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from flask_restplus import Api

from .cat import api as cat_api
from .dog import api as dog_api

api = Api(
    title='Zoo API',
    version='1.0',
    description='A simple demo API',
)

api.add_namespace(cat_api)
api.add_namespace(dog_api)
开发者ID:Dlotan,项目名称:flask-restplus,代码行数:15,代码来源:__init__.py

示例7: Api

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
from flask_restplus import Api

from .base import api as ns_base
from .stats import api as ns_stats
from .euro import api as ns_euro

api = Api(
    Title="Karma Pi",
    version='0.0.1',
    description="Data with added karma and pi",
    )

api.add_namespace(ns_base)
api.add_namespace(ns_stats)
api.add_namespace(ns_euro)
开发者ID:openbermuda,项目名称:karmapi,代码行数:17,代码来源:__init__.py

示例8: Api

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
# This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3), copied verbatim in the file "LICENSE".
# In applying this license, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as Intergovernmental Organization
# or submit itself to any jurisdiction.
import logging

from flask_restplus import Api

from .storage import api as unified_ns
from .introspect import api as introspection_ns
from .common.auth import authorizations

logging.getLogger(__name__).addHandler(logging.NullHandler())

__version__ = '3.2.0'
__major_version__ = __version__.split(".")[0]
INTROSPECTION_MOUNTPOINT = "/conf"
SAPI_MOUNTPOINT = "/v{}".format(__major_version__)

api = Api(
    title='CERN Unified Storage API',
    version=__version__,
    description='A unified storage API for all data-storage back-ends.',
    authorizations=authorizations,
    validate=True,
)

api.add_namespace(unified_ns, path=SAPI_MOUNTPOINT)
api.add_namespace(introspection_ns, path=INTROSPECTION_MOUNTPOINT)
开发者ID:cerndb,项目名称:storage-api,代码行数:32,代码来源:__init__.py

示例9: print

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
    print(data)
    return render_template("iris.html",
                           iris=data['complete_code'],
                           name=data['name'],
                           citycode=data['citycode'],
                           city=data['city'],
                           iris_type=data['type'])


api = Api(service,
          title='INSEE/IRIS Geolocalizer',
          ui=False,
          prefix='/api',
          version='0.1',
          description="Retrieve some data related to the IRIS codes. Look for an IRIS from an address.")
api.add_namespace(insee_api)

geojson_parser = api.parser()
geojson_parser.add_argument("geojson", type=inputs.boolean, default=False, location='args',
                            help='GeoJSON')

iris_code_parser = geojson_parser.copy()
iris_code_parser.add_argument("limit", required=False, default=10, dest='limit',
                              location='args', help='Limit')

address_parser = geojson_parser.copy()
address_parser.add_argument("q", required=True, dest='q', location='args',
                            help='Query')

coords_parser = geojson_parser.copy()
coords_parser.add_argument("lat", required=True, type=float, dest='lat', location='args',
开发者ID:garaud,项目名称:pyris,代码行数:33,代码来源:app.py

示例10: Blueprint

# 需要导入模块: from flask_restplus import Api [as 别名]
# 或者: from flask_restplus.Api import add_namespace [as 别名]
# app/__init__.py

from flask_restplus import Api
from flask import Blueprint

from .main.controller.user_controller import api as user_ns

blueprint = Blueprint('api', __name__)

api = Api(
    blueprint,
    title='FLASK RESTPLUS API WITH JWT',
    version='1.0',
    description='a boilerplate for flask restplus web service'
)

api.add_namespace(user_ns, path='/user')
开发者ID:drvarner,项目名称:flask-rest,代码行数:19,代码来源:__init__.py


注:本文中的flask_restplus.Api.add_namespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。