From f045f5bec2b4fa5c3483d27169b351a66b614f91 Mon Sep 17 00:00:00 2001
From: Greg Lange <greglange@gmail.com>
Date: Fri, 7 Jun 2013 19:44:42 +0000
Subject: [PATCH] Changed the call to set_tunnel to work in python 2.6 or
 python 2.7 since its name changed between versions

Change-Id: I5550049435002b42c4fea06d41549a1e7254ac02
---
 swiftclient/client.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/swiftclient/client.py b/swiftclient/client.py
index afd85f0f..fb3caf5f 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -181,7 +181,12 @@ def http_connection(url, proxy=None):
         return request_escaped
     conn.request = request_wrapper(conn.request)
     if proxy:
-        conn._set_tunnel(parsed.hostname, parsed.port)
+        try:
+            # python 2.6 method
+            conn._set_tunnel(parsed.hostname, parsed.port)
+        except AttributeError:
+            # python 2.7 method
+            conn.set_tunnel(parsed.hostname, parsed.port)
     return parsed, conn