Skip to content
Myr

Merge pull request #633 from tzuryby/develop

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

poor man's patch for issue #630

authored by Kenneth Reitz · committed by Kenneth Reitz · parents ad8205f, 7125fe5 · Browse files · 1 file+21 added−14 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+21 added−14 removed

  • other:+21 added−14 removed

1 file+21 added−14 removed

modified:requests/utils.py+21 added-14 removed
405 unmodified lines
406 + "0123456789-._~")407408409def unquote_unreserved(uri):410 '''411 this try catch is a poor man's patch for issue #630412 https://github.com/kennethreitz/requests/issues/630413 '''414 try:410 """Un-escape any percent-escape sequences in a URI that are unreserved411 characters.412 This leaves all reserved, illegal and non-ASCII bytes encoded.413 """414 parts = uri.split('%')415 for i in range(1, len(parts)):416 h = parts[i][0:2]417 if len(h) == 2:418 c = chr(int(h, 16))419 if c in UNRESERVED_SET:420 parts[i] = c + parts[i][2:]415 """Un-escape any percent-escape sequences in a URI that are unreserved416 characters.417 This leaves all reserved, illegal and non-ASCII bytes encoded.418 """419 parts = uri.split('%')420 for i in range(1, len(parts)):421 h = parts[i][0:2]422 if len(h) == 2:423 c = chr(int(h, 16))424 if c in UNRESERVED_SET:425 parts[i] = c + parts[i][2:]426 else:427 parts[i] = '%' + parts[i]428 else:429 parts[i] = '%' + parts[i]423 else:424 parts[i] = '%' + parts[i]425 return ''.join(parts)430 return ''.join(parts)431 except:432 return uri433434435def requote_uri(uri):436 """Re-quote the given URI.
24 unmodified lines