Merge "Cleanup session object"

This commit is contained in:
Zuul 2019-12-11 08:16:27 +00:00 committed by Gerrit Code Review
commit e8c08e0c4d
1 changed files with 9 additions and 0 deletions

View File

@ -183,6 +183,15 @@ class HTTPClient(_BaseHTTPClient):
self.session.cert = (kwargs.get('cert_file'),
kwargs.get('key_file'))
def __del__(self):
if self.session:
try:
self.session.close()
except Exception as e:
LOG.exception(e)
finally:
self.session = None
@staticmethod
def parse_endpoint(endpoint):
return netutils.urlsplit(endpoint)