Fix issue14826 - make urllib.request.Request quoted url consistent with URLOpener open method.

Patch contributed by Stephen Thorne.
This commit is contained in:
Senthil Kumaran 2012-07-07 17:11:44 -07:00
parent 11f0b41e9d
commit b7451cecad
3 changed files with 12 additions and 1 deletions

View file

@ -180,7 +180,8 @@ class Request:
def __init__(self, url, data=None, headers={},
origin_req_host=None, unverifiable=False):
# unwrap('<URL:type://host/path>') --> 'type://host/path'
self.full_url = unwrap(url)
self.full_url = unwrap(to_bytes(url))
self.full_url = quote(self.full_url, safe="%/:=&?~#+!$,;'@()*[]|")
self.full_url, self.fragment = splittag(self.full_url)
self.data = data
self.headers = {}