From: Rohan Jain Date: Fri, 4 May 2012 05:14:07 +0000 (+0530) Subject: Use utility for environment proxy as fallback X-Git-Tag: v0.12.1~8^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abc38cf17f4e7149cff2da96fa364e4a5d39a632;p=services%2Fpython-requests.git Use utility for environment proxy as fallback Signed-off-by: Rohan Jain --- diff --git a/requests/models.py b/requests/models.py index 8319525..b2d0ed5 100644 --- a/requests/models.py +++ b/requests/models.py @@ -28,7 +28,7 @@ from .exceptions import ( URLRequired, SSLError, MissingSchema, InvalidSchema, InvalidURL) from .utils import ( get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri, - stream_decode_response_unicode, get_netrc_auth, + stream_decode_response_unicode, get_netrc_auth, get_environ_proxies, DEFAULT_CA_BUNDLE_PATH) from .compat import ( cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes, @@ -112,10 +112,7 @@ class Request(object): # If no proxies are given, allow configuration by environment variables # HTTP_PROXY and HTTPS_PROXY. if not self.proxies and self.config.get('trust_env'): - if 'HTTP_PROXY' in os.environ: - self.proxies['http'] = os.environ['HTTP_PROXY'] - if 'HTTPS_PROXY' in os.environ: - self.proxies['https'] = os.environ['HTTPS_PROXY'] + self.proxies = get_environ_proxies() self.data = data self.params = params