def ping(self, path=None):
request = HTTPRequest(
url=self.endpoint + (path or self.api_path),
method='GET',
headers=self.headers,
follow_redirects=False,
request_timeout=100
)
try:
yield self.outbound_client.fetch(request)
except HTTPError as ex: # pragma: no cover
if ex.code == 307:
raise_from(MasterRedirect(
urlparse(ex.response.headers['location']).netloc), None)
except ConnectionRefusedError as ex: # pragma: no cover
log.debug("Problem reaching: %s" % self.endpoint)
raise ex
except Exception as ex: # pragma: no cover
log.debug("Unhandled exception when connecting to %s",
self.endpoint)
raise ex
评论列表
文章目录