In a Python3 CGI script, how can I read the raw form data in a POST?
问题 Yes, I'm aware of cgi.FieldStorage , but, being some form of unordered dictionary, it does not preserve the order of the original data (see below for proof). Since I wish to use this data with PayPal IPN, order is important PayPal docs here, which say "...you must send back the contents in the exact order they were received..." Alternatively, os.environ.get('QUERY_STRING') looks perfect, however, it seems to only work for a GET . Example code: (myscript.py) #!/usr/bin/python3 import cgi, os