Skip to content
Myr

Fix linting issues

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

authored by Nate Prewitt · committed by GitHub · parent 147c851 · Browse files · 2 files+10 added−9 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+10 added−9 removed

  • tests:+9 added−8 removed
  • other:+1 added−1 removed

2 files+10 added−9 removed

modified:requests/sessions.py+1 added-1 removed
324 unmodified lines
325 username, password = None, None326327 # urllib3 handles proxy authorization for us in the standard adapter.328 # Avoid appending this to TLS tunneled requests where it may be leaked.329 if not scheme.startswith('https') and username and password:329 if not scheme.startswith("https") and username and password:330 headers["Proxy-Authorization"] = _basic_auth_str(username, password)331332 return new_proxies333
500 unmodified lines
modified:tests/test_requests.py+9 added-8 removed
645 unmodified lines
646 sent_headers = resp.json().get("headers", {})647648 assert sent_headers.get("Proxy-Authorization") == proxy_auth_value649650650 @pytest.mark.parametrize(651 "url,has_proxy_auth",652 (654 ('http://example.com', True),655 ('https://example.com', False),653 ("http://example.com", True),654 ("https://example.com", False),655 ),656 )658 def test_proxy_authorization_not_appended_to_https_request(self, url, has_proxy_auth):657 def test_proxy_authorization_not_appended_to_https_request(658 self, url, has_proxy_auth659 ):660 session = requests.Session()661 proxies = {661 'http': 'http://test:pass@localhost:8080',662 'https': 'http://test:pass@localhost:8090',662 "http": "http://test:pass@localhost:8080",663 "https": "http://test:pass@localhost:8090",664 }664 req = requests.Request('GET', url)665 req = requests.Request("GET", url)666 prep = req.prepare()667 session.rebuild_proxies(prep, proxies)668668 assert ('Proxy-Authorization' in prep.headers) is has_proxy_auth669 assert ("Proxy-Authorization" in prep.headers) is has_proxy_auth670671 def test_basicauth_with_netrc(self, httpbin):672 auth = ("user", "pass")673 wrong_auth = ("wronguser", "wrongpass")
2138 unmodified lines