當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。