Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python CherryPy post文件请求导致文件对象问题_Python_File_Flask_Python Requests_Cherrypy - Fatal编程技术网

Python CherryPy post文件请求导致文件对象问题

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) 文件对象是: 此时的文件对象是正确的,工作正常 烧瓶

这项工作的主要主题是将请求文件从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)
文件对象是:

此时的文件对象是正确的,工作正常

烧瓶端:

@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的内容只包括
请求
代码,这是另一回事。