Answers for "deode cig.filestorage python"

0

deode cig.filestorage python

def __parse_post_body(environ, ignore_get=False):
    post_data = {}

    # accept post json
    if environ["CONTENT_TYPE"].strip(';') == "application/json" and environ["REQUEST_METHOD"] == "POST":
        storage = environ['wsgi.input'].read()
        if storage:
            return json.loads(storage)

    storage = FieldStorage(environ['wsgi.input'], environ=environ, keep_blank_values=True)

    # accept get querystring
    if not ignore_get:
        for k in storage.keys():
            post_data[k] = storage.getvalue(k)

    return post_data
Posted by: Guest on October-16-2020

Python Answers by Framework

Browse Popular Code Answers by Language