deploy_testbed.py 文件源码

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

项目:automation 作者: kubic-project 项目源码 文件源码
def _api_get(self, path):
        ctx = http.client.ssl._create_stdlib_context()
        conn = http.client.HTTPSConnection(self._api, timeout=20, context=ctx)
        log.info("calling {}/<**token**>{}".format(self._api, path))
        tpath = '/' + self._api_token + path
        # Do not leak out token in production
        # log.info("calling {}{}".format(self._api, tpath))
        try:
            conn.request('GET', tpath)
            response = conn.getresponse().read().decode('utf-8')
        except socket.timeout:
            log.info("socket timeout")
            raise APIError('testbed daemon socket timeout')
        j = self._parse(response)
        if j["status"] != "ok":
            raise APIError(response)
        return j
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号