Skip to content
Myr

Merge branch 'issue_380' of https://github.com/Lukasa/requests into develop

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 · parents dd89df3, 544ebf4 · Browse files · 3 files+20 added−1 removed
This commit

State

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

Diff stats

3 files+20 added−1 removed

  • tests:+9 added−0 removed
  • other:+11 added−1 removed

3 files+20 added−1 removed

modified:requests/models.py+4 added-1 removed
24 unmodified lines
25 ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects,26 URLRequired, SSLError)27from .utils import (28 get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri,29 dict_from_string)29 dict_from_string, supported_schemes)3031from .compat import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, str, bytes, SimpleCookie, is_py3, is_py23233# Import chardet if it is available.
281 unmodified lines
315316 if not scheme:317 raise ValueError("Invalid URL %r: No schema supplied" % url)318319 if not scheme in supported_schemes():320 raise ValueError("Invalid scheme %r" % scheme)321322 netloc = netloc.encode('idna').decode('utf-8')323324 if not path:325 path = '/'
479 unmodified lines
modified:requests/utils.py+7 added
414 unmodified lines
415 # Then quote only illegal characters (do not quote reserved, unreserved,416 # or '%')417 return quote(unquote_unreserved(uri), safe="!#$%&'()*+,/:;=?@[]~")418 return "/".join(parts)419420def supported_schemes():421 """A list of schemes supported by requests.422423 return: a list of strings.424 """425 return ["http","https"]
modified:tests/test_requests.py+9 added
825 unmodified lines
826 def test_upload_binary_data(self):827828 r = requests.get(httpbin('post'), auth=('a', 'b'), data='\xff')829830 def test_useful_exception_for_invalid_scheme(self):831 832 # If we pass a legitimate URL with a scheme not supported 833 # by requests, we should fail.834 self.assertRaises(835 ValueError,836 get,837 'ftp://ftp.kernel.org/pub/')838839840841if __name__ == '__main__':842 unittest.main()