api.py 文件源码

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

项目:cobalt 作者: PressLabs 项目源码 文件源码
def __init__(self, volume_manager, context):
        """

        Args:
            volume_manager (VolumeManager): The repository object to work with the volumes
            context (dict): A dict containing `host` and `port`
        """
        self._api_loop = None
        self._api_server = None
        self._started = False

        self._connection = ('', 5000)
        try:
            self._connection = (context['host'], int(context['port']))
        except (KeyError, ValueError) as error:
            print('Context provided to api erroneous: {}, defaulting: {}\n{}'.format(context, self._connection, error))

        self.flask_app = Api._create_app(volume_manager)
        self._api_server = WSGIServer(self._connection, self.flask_app)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号