(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[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/module-urllib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/urlopener-objs.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.3 httplib Up: 11.2 urllib Previous: 11.2.1 URLopener Objects
11.2.2 Examples
Here is an example session that uses the "GET" method to retrieve a URL containing parameters:
>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
>>> print f.read()
The following example uses the "POST" method instead:
>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()
|
[[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/module-urllib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/urlopener-objs.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.3 httplib Up: 11.2 urllib Previous: 11.2.1 URLopener Objects
Send comments on this document to python-docs@python.org.