request.py 文件源码

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

项目:backend.ai-client-py 作者: lablup 项目源码 文件源码
def connect_websocket(self, sess=None):
        '''
        Creates a WebSocket connection.
        '''
        assert self.method == 'GET'
        if sess is None:
            sess = aiohttp.ClientSession()
        else:
            assert isinstance(sess, aiohttp.ClientSession)
        try:
            ws = await sess.ws_connect(self.build_url(), headers=self.headers)
            return sess, ws
        except Exception as e:
            msg = 'Request to the API endpoint has failed.\n' \
                  'Check your network connection and/or the server status.'
            raise BackendClientError(msg) from e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号