@@ -669,41 +669,6 @@ and client-side web systems.
669
669
A summary of available frameworks is maintained by Paul Boddie at
670
670
https://wiki.python.org/moin/WebProgramming\ .
671
671
672
- Cameron Laird maintains a useful set of pages about Python web technologies at
673
- https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp.lang.python/web_python.
674
-
675
-
676
- How can I mimic CGI form submission (METHOD=POST)?
677
- --------------------------------------------------
678
-
679
- I would like to retrieve web pages that are the result of POSTing a form. Is
680
- there existing code that would let me do this easily?
681
-
682
- Yes. Here's a simple example that uses :mod:` urllib.request` ::
683
-
684
- #!/usr/local/bin/python
685
-
686
- import urllib.request
687
-
688
- # build the query string
689
- qs = " First=Josephine& MI=Q& Last=Public"
690
-
691
- # connect and send the server a path
692
- req = urllib.request.urlopen('http://www.some-server.out-there'
693
- '/cgi-bin/some-cgi-script', data=qs)
694
- with req:
695
- msg, hdrs = req.read(), req.info()
696
-
697
- Note that in general for percent-encoded POST operations, query strings must be
698
- quoted using :func:` urllib.parse.urlencode` . For example, to send
699
- ` ` name=Guy Steele, Jr.` ` ::
700
-
701
- >>> import urllib.parse
702
- >>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})
703
- 'name=Guy+Steele%2C+Jr.'
704
-
705
- .. seealso:: :ref:` urllib-howto` for extensive examples.
706
-
707
672
708
673
What module should I use to help with generating HTML?
709
674
------------------------------------------------------
0 commit comments