def mixin_request_id(self, resp):
"""mixin request id from request response
:param request.Response resp: http response
"""
if isinstance(resp, Response):
# Extract 'X-Openstack-Request-Id' from headers if
# response is a Response object.
request_id = (resp.headers.get('openstack-request-id') or
resp.headers.get('x-openstack-request-id') or
resp.headers.get('x-compute-request-id'))
else:
# If resp is of type string or None.
request_id = resp
self.request_id = request_id
评论列表
文章目录