Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f54d967 commit e780877Copy full SHA for e780877
1 file changed
Lib/cgi.py
@@ -5,6 +5,7 @@
5
#
6
# modified by Steve Majewski <[email protected]> 12/5/94
7
8
+# now maintained as part of the Python distribution
9
10
# Several classes to parse the name/value pairs that are passed to
11
# a server's CGI by GET, POST or PUT methods by a WWW FORM. This
@@ -42,11 +43,17 @@
42
43
44
45
def parse():
46
+ """Parse the query passed in the environment or on stdin"""
47
if environ['REQUEST_METHOD'] == 'POST':
48
qs = sys.stdin.read(string.atoi(environ['CONTENT_LENGTH']))
49
environ['QUERY_STRING'] = qs
50
else:
51
qs = environ['QUERY_STRING']
52
+ return parse_qs(qs)
53
+
54
55
+def parse_qs(qs):
56
+ """Parse a query given as a string argument"""
57
name_value_pairs = string.splitfields(qs, '&')
58
dict = {}
59
for name_value in name_value_pairs:
0 commit comments