Python - Parsing multipart/form-data request on server side

前端 未结 3 1315
北恋
北恋 2021-01-12 09:00

Im trying to do a http \'POST\' with multipart/form-data to a python GAE backend. My server side method is receiving the complete body but i have absolutely no idea how to p

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 09:14

    You want the .cgi python library.

    Specifically something like this:

    import cgi
    form = cgi.FieldStorage() 
    value1 = form.getfirst("value1", "")
    value2 = form.getfirst("value2", "") 
    value3 = form.getfirst("value3", "") 
    logtext = form.getfirst("logText", "")
    

提交回复
热议问题