mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
#17307 - merge from 3.2
This commit is contained in:
commit
e66cc8172d
2 changed files with 27 additions and 0 deletions
|
|
@ -1109,6 +1109,15 @@ The code for the sample CGI used in the above example is::
|
|||
data = sys.stdin.read()
|
||||
print('Content-type: text-plain\n\nGot Data: "%s"' % data)
|
||||
|
||||
Here is an example of doing a ``PUT`` request using :class:`Request`::
|
||||
|
||||
import urllib.request
|
||||
DATA=b'some data'
|
||||
req = urllib.request.Request(url='http://localhost:8080', data=DATA,method='PUT')
|
||||
f = urllib.request.urlopen(req)
|
||||
print(f.status)
|
||||
print(f.reason)
|
||||
|
||||
Use of Basic HTTP Authentication::
|
||||
|
||||
import urllib.request
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue