mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #25576: Merge www-form-urlencoded doc from 3.4 into 3.5
This commit is contained in:
commit
f7e8d07538
3 changed files with 16 additions and 30 deletions
|
@ -115,7 +115,7 @@ library. ::
|
|||
'language' : 'Python' }
|
||||
|
||||
data = urllib.parse.urlencode(values)
|
||||
data = data.encode('utf-8') # data should be bytes
|
||||
data = data.encode('ascii') # data should be bytes
|
||||
req = urllib.request.Request(url, data)
|
||||
with urllib.request.urlopen(req) as response:
|
||||
the_page = response.read()
|
||||
|
@ -180,8 +180,8 @@ Explorer [#]_. ::
|
|||
'language' : 'Python' }
|
||||
headers = { 'User-Agent' : user_agent }
|
||||
|
||||
data = urllib.parse.urlencode(values)
|
||||
data = data.encode('utf-8')
|
||||
data = urllib.parse.urlencode(values)
|
||||
data = data.encode('ascii')
|
||||
req = urllib.request.Request(url, data, headers)
|
||||
with urllib.request.urlopen(req) as response:
|
||||
the_page = response.read()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue