我正在尝试将 POST 的价值与multipart/form-data
我的后端联系起来。
提出请求:
files = {
'image': ('youtried.jpg', (open('youtried.jpg', 'rb')), 'image/jpg', {'Expires': '0'}),
'name': 'Deojeff'
}
r = requests.post('http://localhost/service/images', files=files)
print (r.text)
处理请求:
def on_post(self, req, resp):
"""Creates an image."""
x = req.stream.read()
base64.b64encode(x)
helpers.write_json(resp, falcon.HTTP_200, {
'name': str(x)
})
如何在我的班级的 on_post 方法中获取 'name' 的值(在本例中为 'Deojeff' )?