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
This commit is contained in:
Greg Lange 2013-06-07 19:44:42 +00:00
parent 2d12f09c66
commit f045f5bec2

@ -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