From 9fe79a4aacfd47be6a1d92097c1d84ccd6763073 Mon Sep 17 00:00:00 2001 From: Feng Liu Date: Thu, 17 Oct 2013 11:12:06 +0800 Subject: Add close to swiftclient.client.Connection Change-Id: I2f5fa9c46886607a9ba99e8915ea84ac4975d004 --- swiftclient/client.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'swiftclient') diff --git a/swiftclient/client.py b/swiftclient/client.py index 3bbbc54..155c8cb 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -1072,6 +1072,14 @@ class Connection(object): self.insecure = insecure self.ssl_compression = ssl_compression + def close(self): + if self.http_conn and type(self.http_conn) is tuple\ + and len(self.http_conn) > 1: + conn = self.http_conn[1] + if hasattr(conn, 'close') and callable(conn.close): + conn.close() + self.http_conn = None + def get_auth(self): return get_auth(self.authurl, self.user, self.key, snet=self.snet, -- cgit v1.2.1