diff options
| author | Feng Liu <mefengliu23@gmail.com> | 2013-10-17 11:12:06 +0800 |
|---|---|---|
| committer | Feng Liu <mefengliu23@gmail.com> | 2013-10-23 11:31:10 +0800 |
| commit | 9fe79a4aacfd47be6a1d92097c1d84ccd6763073 (patch) | |
| tree | c7be028884d96268c537456b2d3aaf6dd7ab6813 /swiftclient/client.py | |
| parent | 775a24b1bcb580216754e56b5384f05815372791 (diff) | |
| download | python-swiftclient-9fe79a4aacfd47be6a1d92097c1d84ccd6763073.tar.gz | |
Add close to swiftclient.client.Connection
Change-Id: I2f5fa9c46886607a9ba99e8915ea84ac4975d004
Diffstat (limited to 'swiftclient/client.py')
| -rw-r--r-- | swiftclient/client.py | 8 |
1 files changed, 8 insertions, 0 deletions
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, |
