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
评论列表
文章目录