Flask - How do I read the raw body in a POST request when the content type is “application/x-www-form-urlencoded”

前端 未结 4 820
既然无缘
既然无缘 2020-12-31 06:23

Turns out that Flask sets request.data to an empty string if the content type of the request is application/x-www-form-urlencoded. Since I\'m using

4条回答
  •  温柔的废话
    2020-12-31 07:19

    try this:

    f = request.form
    
       output = []
    
       user_data = {}
    
       user_data['email'] = f['email']
    
       user_data['password'] = f['password']
    
       user_data['key'] = f['key']
    
       output.append(user_data)
    

提交回复
热议问题