本文整理汇总了Python中flask_restplus.fields.Integer方法的典型用法代码示例。如果您正苦于以下问题:Python fields.Integer方法的具体用法?Python fields.Integer怎么用?Python fields.Integer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_restplus.fields
的用法示例。
在下文中一共展示了fields.Integer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from flask_restplus import fields [as 别名]
# 或者: from flask_restplus.fields import Integer [as 别名]
def init(api, cors, impl):
"""Configures REST handlers for cell resource."""
namespace = webutils.namespace(
api, __name__, 'Ticket Locker REST operations'
)
model = {
'expires_at': fields.Integer(description='Ticket expiration time.'),
}
resp_model = api.model(
'Ticket', model
)
@namespace.route('/')
class _TicketsList(restplus.Resource):
"""Treadmill Ticket list resource"""
def get(self):
"""Returns list of available tickets."""
return impl.list()
@namespace.route('/@')
class _TickeUserResource(restplus.Resource):
"""Treadmill Ticket resource."""
@webutils.get_api(api, cors,
marshal=api.marshal_with,
resp_model=resp_model)
def get(self):
"""Return Treadmill Ticket details for the authenticated user."""
return impl.get(flask.g.get('user'))
@namespace.route('/<principal>')
@api.doc(params={'principal': 'Principal name'})
class _TicketResource(restplus.Resource):
"""Treadmill Ticket resource."""
@webutils.get_api(api, cors,
marshal=api.marshal_with,
resp_model=resp_model)
def get(self, principal):
"""Return Treadmill Ticket details."""
return impl.get(principal)
示例2: init
# 需要导入模块: from flask_restplus import fields [as 别名]
# 或者: from flask_restplus.fields import Integer [as 别名]
def init(api, cors, impl):
"""Configures REST handlers for endpoint resource."""
# Disable too many branches warning.
#
# pylint: disable=R0912
namespace = webutils.namespace(
api, __name__, 'Endpoint state REST operations'
)
endpoint_model = {
'endpoint': fields.String(description='Endpoint name'),
'name': fields.String(description='Application name'),
'port': fields.Integer(description='Endpoint port'),
'proto': fields.String(description='Application endpoint protocol'),
'host': fields.String(description='Endpoint host'),
'state': fields.Boolean(description='Endpoint state'),
}
response_model = api.model(
'Endpoint', endpoint_model
)
@namespace.route(
'/<pattern>',
)
@api.doc(params={'pattern': 'Application pattern'})
class _EndpointList(restplus.Resource):
"""Treadmill Endpoint resource"""
@webutils.get_api(api, cors,
marshal=api.marshal_list_with,
resp_model=response_model)
def get(self, pattern):
"""Return all endpoints"""
ret = impl.list(pattern, None, None)
return ret
@namespace.route('/<pattern>/<proto>/<endpoint>')
@api.doc(params={
'pattern': 'Application pattern',
'proto': 'Application endpoint protocol',
'endpoint': 'Application endpoint name',
})
class _EndpointResource(restplus.Resource):
"""Treadmill Endpoint resource"""
@webutils.get_api(api, cors,
marshal=api.marshal_list_with,
resp_model=response_model)
def get(self, pattern, proto, endpoint):
"""Return Treadmill app endpoint state"""
ret = impl.list(pattern, proto, endpoint)
return ret