Skip to content
Myr

Better percent-escape exception.

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 · parent bd1f140 · Browse files · 1 file+6 added−2 removed
This commit

State

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

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:requests/utils.py+6 added-2 removed
23 unmodified lines
24from .compat import (quote, urlparse, bytes, str, OrderedDict, urlunparse,25 is_py2, is_py3, builtin_str, getproxies, proxy_bypass)26from .cookies import RequestsCookieJar, cookiejar_from_dict27from .structures import CaseInsensitiveDict28from .exceptions import MissingSchema28from .exceptions import MissingSchema, InvalidURL2930_hush_pyflakes = (RequestsCookieJar,)3132NETRC_FILES = ('.netrc', '_netrc')
329 unmodified lines
362 parts = uri.split('%')363 for i in range(1, len(parts)):364 h = parts[i][0:2]365 if len(h) == 2 and h.isalnum():366 try:366 c = chr(int(h, 16))367 c = chr(int(h, 16))368 except ValueError:369 raise InvalidURL("Invalid percent-escape sequence: '%s'" % h)370371 if c in UNRESERVED_SET:372 parts[i] = c + parts[i][2:]373 else:374 parts[i] = '%' + parts[i]
193 unmodified lines