(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/urlopener-objs.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-urllib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-httplib.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/genindex.html| ]]
|
Previous: 11.3.1 URLopener Objects Up: 11.3 urllib Next: 11.4 httplib
11.3.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/20/lib/urlopener-objs.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-urllib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-httplib.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/genindex.html| ]]
|
Previous: 11.3.1 URLopener Objects Up: 11.3 urllib Next: 11.4 httplib
See About this document... for information on suggesting changes.