Python Frequently Asked Questions, Release 3.9.5 Or you can use the numeric constants 0, 1 and 2, respectively. 4.5 Network/Internet Programming 4.5.1 What WWW tools are there for Python? 4.5.2 How can I mimic CGI form submission (METHOD=POST)? See the chapters titled internet and netdata in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems. A summary of available frameworks is maintained by Paul Boddie at https://wiki.python.org/moin/ WebProgramming. Cameron Laird maintains a useful set of pages about Python web technologies at http://phaseit.net/claird/comp.lang. python/web_python. I would like to retrieve web pages that are the result of POSTing a form. Is there existing code that would let me do this easily? Yes. Here’s a simple example that uses$_{urllib.request}$ : Note that in general for percent-encoded POST operations, query strings must be quoted using$_{urllib.parse.}$ urlencode() . For example, to send$_{name=Guy Steele, Jr.}$ : urllib-howto for extensive examples. #!/usr/local/bin/python import urllib.request # build the query string qs ="First=Josephine&MI=Q&Last=Public " # connect and send the server a path req =urllib.request.urlopen( 'http://www.some-server.out-there ' '/cgi-bin/some-cgi-script ', data =qs) with req: msg, hdrs=req.read(), req .info() >>> import urllib.parse >>> urllib.parse.urlencode({'name':'Guy Steele, Jr. '}) 'name=Guy+Steele%2C+Jr.' See also: os.close(stdin .fileno()) os.close(stdout .fileno()) os.close(stderr .fileno()) Chapter 4. Library and Extension FAQ 56