Skip to content
Myr

proxy manager

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent c3431bb · Browse files · 2 files+16 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−3 removed

  • other:+16 added−3 removed

2 files+16 added−3 removed

modified:requests/adapters.py+1 added-1 removed
125 unmodified lines
126 proxies = proxies or {}127 proxy = proxies.get(urlparse(url).scheme)128129 if proxy:130 conn = poolmanager.proxy_from_url(proxy)130 conn = self.poolmanager.ProxyManager(self.poolmanager.proxy_from_url(proxy))131 else:132 conn = self.poolmanager.connection_from_url(url)133134 return conn
52 unmodified lines
modified:requests/sessions.py+15 added-2 removed
17 unmodified lines
1819from .compat import urlparse, urljoin20from .adapters import HTTPAdapter2122from .utils import requote_uri22from .utils import requote_uri, get_environ_proxies, get_netrc_auth2324from .status_codes import codes25REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)26DEFAULT_REDIRECT_LIMIT = 30
176 unmodified lines
203 verify=None,204 cert=None):205206 cookies = cookies or {}207 proxies = proxies or {}208209 # Bootstrap CookieJar.210 if not isinstance(cookies, cookielib.CookieJar):211 cookies = cookiejar_from_dict(cookies)
1 unmodified line
213 # Bubble down session cookies.214 for cookie in self.cookies:215 cookies.set_cookie(cookie)216217 # Gather clues from the surrounding environment.218 if self.trust_env:219 # Set environment's proxies.220 env_proxies = get_environ_proxies(url) or {}221 for (k, v) in env_proxies.items():222 proxies.setdefault(k, v)223224 # Set environment's basic authentication.225 if not auth:226 auth = get_netrc_auth(url)227228 # Merge all the kwargs.229 params = merge_kwargs(params, self.params)230 headers = merge_kwargs(headers, self.headers)231 auth = merge_kwargs(auth, self.auth)
2 unmodified lines
234 stream = merge_kwargs(stream, self.stream)235 verify = merge_kwargs(verify, self.verify)236 cert = merge_kwargs(cert, self.cert)237238239 # Create the Request.240 req = Request()241 req.method = method242 req.url = url
8 unmodified lines
251 # Prepare the Request.252 prep = req.prepare()253254 # Send the request.242 resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert)255 resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)256257 # Redirect resolving generator.258 gen = self.resolve_redirects(resp, req, stream, timeout, verify, cert)259
115 unmodified lines