From 80168d6c765a8987a08de1b3888d707b20cab565 Mon Sep 17 00:00:00 2001 From: Tamar Ben-Shachar Date: Mon, 20 Jul 2015 14:37:57 -0700 Subject: [PATCH] accept no_proxy env variable The requests library already processes the http{s}_proxy and no_proxy env variables, and using the `proxies` argument was overwriting, and thus invalidating the no_proxy env variable. --- dcos/http.py | 3 +-- dcos/util.py | 15 --------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/dcos/http.py b/dcos/http.py index 99dd2b2f7..5b326283e 100644 --- a/dcos/http.py +++ b/dcos/http.py @@ -82,8 +82,7 @@ def request(method, try: with requests.Session() as session: - response = session.send(request.prepare(), timeout=timeout, - proxies=util.get_proxy_dict_from_env()) + response = session.send(request.prepare(), timeout=timeout) except Exception as ex: raise to_exception(ex) diff --git a/dcos/util.py b/dcos/util.py index d708df7f7..b7e5a15df 100644 --- a/dcos/util.py +++ b/dcos/util.py @@ -583,21 +583,6 @@ def stream(fn, objs): yield job, jobs[job] -def get_proxy_dict_from_env(): - """ Returns dict with proxy parameters - - :returns: Dict with proxy parameters - :rtype: dict - """ - - proxies = dict() - - for name, value in os.environ.items(): - if value and (name == 'http_proxy' or name == 'https_proxy'): - proxies[name] = value - return proxies - - def get_ssh_options(config_file, options): """Returns the SSH arguments for the given parameters. Used by commands that wrap SSH.