Skip to content
Myr

Rename utils.requote_path to requote_uri.

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

It is now applied to a whole URI, not just the path.

authored by Matt Giuca · committed by Matt Giuca · parent 3bd5406 · Browse files · 2 files+6 added−6 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+6 added−6 removed

  • other:+6 added−6 removed

2 files+6 added−6 removed

modified:requests/models.py+2 added-2 removed
24 unmodified lines
25 ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects,26 URLRequired, SSLError)27from .utils import (28 get_encoding_from_headers, stream_decode_response_unicode,29 stream_decompress, guess_filename, requote_path, dict_from_string)29 stream_decompress, guess_filename, requote_uri, dict_from_string)3031from .compat import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, str, bytes, SimpleCookie, is_py3, is_py23233# Import chardet if it is available.
307 unmodified lines
341 url = '%s&%s' % (url, self._enc_params)342 else:343 url = '%s?%s' % (url, self._enc_params)344345 url = requote_path(url)345 url = requote_uri(url)346347 return url348349 @property
454 unmodified lines
modified:requests/utils.py+4 added-4 removed
417 unmodified lines
418 else:419 parts[i] = '%' + parts[i]420 return ''.join(parts)421422def requote_path(path):423 """Re-quote the given URL path component.422def requote_uri(uri):423 """Re-quote the given URI.424425 This function passes the given path through an unquote/quote cycle to425 This function passes the given URI through an unquote/quote cycle to426 ensure that it is fully and consistently quoted.427 """428 # Unquote only the unreserved characters429 # Then quote only illegal characters (do not quote reserved, unreserved,430 # or '%')431 return quote(unquote_unreserved(path), safe="!#$%&'()*+,/:;=?@[]~")431 return quote(unquote_unreserved(uri), safe="!#$%&'()*+,/:;=?@[]~")432 return "/".join(parts)