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


Python flask_restplus.Namespace类代码示例

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


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

示例1: test_clone

    def test_clone(self):
        api = Namespace('test')
        parent = api.model('Parent', {})
        api.clone('Child', parent, {})

        assert 'Child' in api.models
        assert 'Parent' in api.models
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:7,代码来源:test_namespace.py

示例2: test_inherit

    def test_inherit(self):
        api = Namespace('test')
        parent = api.model('Parent', {})
        api.inherit('Child', parent, {})

        self.assertIn('Parent', api.models)
        self.assertIn('Child', api.models)
开发者ID:Dlotan,项目名称:flask-restplus,代码行数:7,代码来源:test_namespace.py

示例3: test_clone_with_multiple_parents

    def test_clone_with_multiple_parents(self):
        api = Namespace('test')
        grand_parent = api.model('GrandParent', {})
        parent = api.model('Parent', {})
        api.clone('Child', grand_parent, parent, {})

        assert 'Child' in api.models
        assert 'Parent' in api.models
        assert 'GrandParent' in api.models
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:9,代码来源:test_namespace.py

示例4: test_inherit_from_multiple_parents

    def test_inherit_from_multiple_parents(self):
        api = Namespace('test')
        grand_parent = api.model('GrandParent', {})
        parent = api.model('Parent', {})
        api.inherit('Child', grand_parent, parent, {})

        assert 'GrandParent' in api.models
        assert 'Parent' in api.models
        assert 'Child' in api.models
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:9,代码来源:test_namespace.py

示例5: test_inherit

    def test_inherit(self):
        authorizations = {
            'apikey': {
                'type': 'apiKey',
                'in': 'header',
                'name': 'X-API-KEY'
            }
        }
        api = Namespace('test', authorizations=authorizations)
        parent = api.model('Parent', {})
        api.inherit('Child', parent, {})

        assert 'Parent' in api.models
        assert 'Child' in api.models
        assert api.authorizations == authorizations
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:15,代码来源:test_namespace.py

示例6: Namespace

from flask import request, abort, url_for
from flask_restplus import fields, Namespace, reqparse, Resource, Api
from flask_login import current_user
from mgipython.util import error_template
from mgipython.model import *
from mgipython.service import *
from mgipython.service_schema import *
from pwi import app

# API Classes

api = Namespace('vocterm', description='VocTerm module operations')

# Define the API for fields that you can search by
vocterm_parser = reqparse.RequestParser()
vocterm_parser.add_argument('_term_key')
vocterm_parser.add_argument('_vocab_key')
vocterm_parser.add_argument('vocab_name')
vocterm_parser.add_argument('id')
vocterm_parser.add_argument('creation_date')
vocterm_parser.add_argument('modification_date')

vocterm_model = api.model('VocTerm', {
    '_term_key': fields.Integer,
    '_vocab_key': fields.Integer,
    'vocab_name': fields.String,
    'id': fields.String,
    'creation_date': fields.DateTime,
    'modification_date': fields.DateTime                            
})
开发者ID:mgijax,项目名称:pwi,代码行数:30,代码来源:vocterm_api.py

示例7: test_schema_model

 def test_schema_model(self):
     api = Namespace('test')
     api.schema_model('Person', {})
     assert 'Person' in api.models
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:4,代码来源:test_namespace.py

示例8: Namespace

#!../../../bin/python
import logging
import json
from flask import session
from flask_restplus import Resource, Namespace, fields, reqparse, abort
from flask_restplus.inputs import boolean
from db import datastore
from ..restplus import api
from ..decorators import require_token, require_admin
from helpers import addWhiskey, deleteWhiskey, updateWhiskey, getAllWhiskeyNames

logger = logging.getLogger("whiskey-routes")
whiskeyApi = Namespace('whiskey', description='Whiskey related operations')

whiskey = whiskeyApi.model('Whiskey', {
    'name': fields.String(required=True, description='The name of the whiskey'),
    'proof': fields.Float(required=True, description='The proof of the whiskey'),
    'price': fields.Float(required=True, description='The price of the whiskey'),
    'style': fields.String(required=True, description='The style of whiskey'),
    'age': fields.Integer(required=True, description='The age of the whiskey'),
    'icon': fields.Url(required=False, absolute=True, description='The url for the whiskey icon'),
    'url': fields.Url(required=False, absolute=True, description='The original url for the whiskey icon')
})

dbm = datastore.DbManager(testMode=False)

getAllParser = whiskeyApi.parser()
getAllParser.add_argument('currentPage', type=int, required=True, default=1, help='Current page of the query, count starts at 1')
getAllParser.add_argument('itemsPerPage', type=int, required=True, default=20, help='Number of items returned per page, max=100')
getAllParser.add_argument('sortField', type=str, required=False, default='name', help='The name of the field to sort on: name, price, proof, style, or age')
getAllParser.add_argument('namesOnly', type=boolean, required=False, default=False, help='Return just a list of Whiskey names')
开发者ID:healem,项目名称:wbtn_website,代码行数:31,代码来源:routes.py

示例9: Namespace

import datetime
import json

from flask.ext.jwt import current_identity, jwt_required
from flask_restplus import Namespace, Resource, fields, reqparse

from packr.models import Order, OrderStatus, StatusType

api = Namespace('update',
                description='Operations related to updating an order')

update_status = api.model('UpdateStatus', {
    'con_number': fields.Integer(readOnly=True,
                                 description='The consignment number'),
    'status': fields.String(readOnly=True,
                            description='The new status')
})

update_driver = api.model('UpdateDriver', {
    'con_number': fields.Integer(readOnly=True,
                                 description='The consignment number'),
    'adminComments': fields.String(readOnly=True,
                                   description='The admin comments')
})

update_admin = api.model('UpdateAdmin', {
    'con_number': fields.Integer(readOnly=True,
                                 description='The consignment number'),
    'driver': fields.String(readOnly=True,
                            description='The driver'),
    'eta': fields.String(readOnly=True,
开发者ID:KnightHawk3,项目名称:packr,代码行数:31,代码来源:update.py

示例10: test_model

 def test_model(self):
     api = Namespace('test')
     api.model('Person', {})
     self.assertIn('Person', api.models)
开发者ID:Dlotan,项目名称:flask-restplus,代码行数:4,代码来源:test_namespace.py

示例11: Namespace

from karmapi import base

from flask import request
from flask_restplus import Namespace, Resource, fields

api = Namespace("euro", description="api for euro")


from karmapi.meta.weather import Image
Image = api.model("Image", Image)


@api.route('/locations/<location>/<item>')
class location(Resource):
    """ Rough notes on how to plot centred on a location using basemap

    What I really want to do is implement a Karma Pi path something like
    this:

    locations/{location}/{item}

    That will show you {item} from location's point of view.

    Now {item} works best if it does not have any /'s, so for
    the item parameter we'll convert /'s to ,'s and see how that looks.

    The idea is {item} will be a path to something in Karma Pi.

    So here is how it might go:
开发者ID:openbermuda,项目名称:karmapi,代码行数:29,代码来源:euro.py

示例12: Namespace

Created on 22.07.2016

@author: Jonas
'''
from flask.globals import request, session
from flask_restplus import Namespace, Model, fields
from flask_restplus import Resource
from werkzeug.utils import secure_filename

from son_editor.app.exceptions import InvalidArgument
from son_editor.impl import functionsimpl, catalogue_servicesimpl
from son_editor.impl.private_catalogue_impl import publish_private_nsfs
from son_editor.util.constants import get_parent, Category, WORKSPACES, PROJECTS, CATALOGUES, PLATFORMS, VNFS
from son_editor.util.requestutil import prepare_response, get_json

proj_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + PROJECTS + "/<int:parent_id>/" + VNFS,
                           description="Project VNF Resources")
cata_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + CATALOGUES + "/<int:parent_id>/" + VNFS,
                           description="Catalogue VNF Resources")
plat_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + PLATFORMS + "/<int:parent_id>/" + VNFS,
                           description="Platform VNF Resources")

funct = Model("VNF", {
    'name': fields.String(required=True, description='The VNF Name'),
    'vendor': fields.String(required=True, description='The VNF Vendor'),
    'version': fields.String(required=True, description='The VNF Version')

})

funct_uid = Model("VNF", {
    'id': fields.String(required=True, description='The VNF UID'),
    'name': fields.String(required=True, description='The VNF Name'),
开发者ID:Jmanuel4SandMan,项目名称:upb-son-editor-backend,代码行数:32,代码来源:functionsapi.py

示例13: test_parser

 def test_parser(self):
     api = Namespace('test')
     assert isinstance(api.parser(), restplus.reqparse.RequestParser)
开发者ID:hivelearning,项目名称:flask-restplus,代码行数:3,代码来源:test_namespace.py

示例14: Namespace

@author: Jonas
'''
import logging

from flask import request
from flask_restplus import Model, Resource, Namespace, fields

from son_editor.impl import platform_connector
from son_editor.impl import servicesimpl, catalogue_servicesimpl
from son_editor.impl.private_catalogue_impl import publish_private_nsfs
from son_editor.util.constants import get_parent, Category, WORKSPACES, PROJECTS, CATALOGUES, PLATFORMS, SERVICES
from son_editor.util.requestutil import prepare_response, get_json

logger = logging.getLogger(__name__)

proj_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + PROJECTS + "/<int:parent_id>/" + SERVICES,
                           description="Project Service Resources")

cata_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + CATALOGUES + "/<int:parent_id>/" + SERVICES,
                           description="Catalogue Service Resources")
plat_namespace = Namespace(WORKSPACES + '/<int:ws_id>/' + PLATFORMS + "/<int:parent_id>/" + SERVICES,
                           description="Platform Service Resources")

serv = Model("Service", {
    'name': fields.String(required=True, description='The Service Name'),
    'vendor': fields.String(required=True, description='The Service Vendor'),
    'version': fields.String(required=True, description='The Service Version')

})

serv_update = Model("Service Update", {
    "descriptor": fields.Nested(model=serv, description="The Complete Service Descriptor")
开发者ID:Jmanuel4SandMan,项目名称:upb-son-editor-backend,代码行数:32,代码来源:servicesapi.py

示例15: Namespace

from flask_restplus import Namespace, Resource, fields

from pyris.api import extract


api = Namespace('insee', description='Some stats from INSEE for each IRIS')

population_parser = api.parser()
population_parser.add_argument("by", required=True, location='args',
                               help="By sex or age")
logement_parser = api.parser()
logement_parser.add_argument("by", required=True, location='args',
                             help="By room, area or year")
activite_parser = api.parser()
activite_parser.add_argument("by", required=True, location='args',
                             help="By sex, age")


@api.route('/')
class InseeData(Resource):
    @api.doc(description='INSEE data list')
    def get(self):
        return ['population', 'activite', 'logement',
                'menage', 'formation']


@api.route('/population/<string:code>')
class IrisPopulation(Resource):
    @api.doc("get the population for an IRIS")
    def get(self, code):
        if len(code) != 9:
开发者ID:garaud,项目名称:pyris,代码行数:31,代码来源:insee.py


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