restapi.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:floranet 作者: Fluent-networks 项目源码 文件源码
def __init__(self, app, server):

        # NetServer
        self.server = server

        # Set the version
        self.version = 1.0

        # Initialise the API
        self.api = Api(app, prefix='/api/v' + str(self.version))

        # Setup routing
        self.resources = {
            # System endpoint
            '/system':                      RestSystem,
            # Device endpoints
            '/device/<int:deveui>':         RestDevice,
            '/devices':                     RestDevices,
            # Application endpoints
            '/app/<int:appeui>':            RestApplication,
            '/apps':                        RestApplications,
            # Gateway endpoints
            '/gateway/<host>':              RestGateway,
            '/gateways':                    RestGateways,
            # Application interface endpoints
            '/interface/<appinterface_id>': RestAppInterface,
            '/interfaces':                  RestAppInterfaces,
            # Application property endpoints
            '/property/<int:appeui>':       RestAppProperty,
            '/propertys':                   RestAppPropertys
        }

        kwargs = {'restapi': self, 'server': self.server}
        for path,klass in self.resources.iteritems():
            self.api.add_resource(klass, path, resource_class_kwargs=kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号