Skip to content

Commit

Permalink
accept no_proxy env variable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tamar Ben-Shachar committed Jul 20, 2015
1 parent bd18363 commit 80168d6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
3 changes: 1 addition & 2 deletions dcos/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
15 changes: 0 additions & 15 deletions dcos/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 80168d6

Please sign in to comment.