From f1190a8d37797183c7728ccea599089c89b95088 Mon Sep 17 00:00:00 2001 From: Saket Choudhary Date: Fri, 17 Jan 2014 05:24:23 +0530 Subject: [PATCH] Add ProxyHandler to auto-detect system proxies --- lib/tool_shed/util/common_util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tool_shed/util/common_util.py b/lib/tool_shed/util/common_util.py index ee4e25d380c..ae07593f279 100644 --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -183,7 +183,11 @@ def parse_repository_dependency_tuple( repository_dependency_tuple, contains_err def tool_shed_get( app, tool_shed_url, uri ): """Make contact with the tool shed via the uri provided.""" registry = app.tool_shed_registry - urlopener = urllib2.build_opener() + ## urllib2 auto-detects system proxies, when passed a Proxyhandler + ## Refer: http://docs.python.org/2/howto/urllib2.html#proxies + proxy = urllib2.ProxyHandler() + urlopener = urllib2.build_opener(proxy) + urllib2.install_opener(urlopener) password_mgr = registry.password_manager_for_url( tool_shed_url ) if password_mgr is not None: auth_handler = urllib2.HTTPBasicAuthHandler( password_mgr )