Skip to content
Myr

Merge pull request #3132 from chipaca/no-hostname-no-cry

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

authored by Cory Benfield · committed by Cory Benfield · parents bbeb000, 4e7beef · Browse files · 2 files+5 added−1 removed
This commit

State

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

Trailers

  • utils: let select_proxy not raise an exception when url has no hostname

Diff stats

2 files+5 added−1 removed

  • tests:+1 added−0 removed
  • other:+4 added−1 removed

2 files+5 added−1 removed

modified:requests/utils.py+4 added-1 removed
577 unmodified lines
578 :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs579 """580 proxies = proxies or {}581 urlparts = urlparse(url)582 if urlparts.hostname is None:583 proxy = None584 else:582 proxy = proxies.get(urlparts.scheme+'://'+urlparts.hostname)585 proxy = proxies.get(urlparts.scheme+'://'+urlparts.hostname)586 if proxy is None:587 proxy = proxies.get(urlparts.scheme)588 return proxy589
139 unmodified lines
modified:tests/test_utils.py+1 added
323 unmodified lines
324 'url, expected', (325 ('hTTp://u:p@Some.Host/path', 'http://some.host.proxy'),326 ('hTTp://u:p@Other.Host/path', 'http://http.proxy'),327 ('hTTps://Other.Host', None),328 ('file:///etc/motd', None),329 ))330def test_select_proxies(url, expected):331 """Make sure we can select per-host proxies correctly."""332 proxies = {'http': 'http://http.proxy',
98 unmodified lines