Python CherryPy post文件请求导致文件对象问题
这项工作的主要主题是将请求文件从cherry py发布到flask并上传,但flask端的file对象变为空: Cherry Py代码:Python CherryPy post文件请求导致文件对象问题,python,file,flask,python-requests,cherrypy,Python,File,Flask,Python Requests,Cherrypy,这项工作的主要主题是将请求文件从cherry py发布到flask并上传,但flask端的file对象变为空: Cherry Py代码: files = {'upload_file' : files_raw_data[i]} values = {'file_path': full_upload_path} response = requests.post(file_storage_url, files=files, data=values) 文件对象是: 此时的文件对象是正确的,工作正常 烧瓶
files = {'upload_file' : files_raw_data[i]}
values = {'file_path': full_upload_path}
response = requests.post(file_storage_url, files=files, data=values)
文件对象是:
此时的文件对象是正确的,工作正常
烧瓶端:
@app.route('/upload_file', methods=['POST'])
def upload_file():
file = request.files['upload_file']
文件对象是:
文件对象在烧瓶端变空我从不使用Cherry Py,但您可以使用
打印(request.files)
或打印(request.dict)
来验证文件是否正确发送
@app.route('/upload_file', methods=['POST'])
def upload_file():
print(request.files)
print(request.__dict__)
可能cherrypy有其他模式发送文件我正在获取其他post数据,但是分配了文件对象,您应该显示cherrypy处理程序代码。您标记为CherryPy的内容只包括
请求
代码,这是另一回事。