(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-ftplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-httplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/node218.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 11.4 ftplib Up: 11.3 httplib Previous: 11.3.1 HTTP Objects
11.3.2 Example
Here is an example session:
>>> import httplib
>>> h = httplib.HTTP('www.cwi.nl')
>>> h.putrequest('GET', '/index.html')
>>> h.putheader('Accept', 'text/html')
>>> h.putheader('Accept', 'text/plain')
>>> h.endheaders()
>>> errcode, errmsg, headers = h.getreply()
>>> print errcode # Should be 200
>>> f = h.getfile()
>>> data = f.read() # Get the raw HTML
>>> f.close()
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-ftplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-httplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/node218.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 11.4 ftplib Up: 11.3 httplib Previous: 11.3.1 HTTP Objects
Send comments on this document to python-docs@python.org.