gpt4 book ai didi

python - http: error: ConnectionError: ('Connection aborted.' , error(32, 'Broken pipe' )) 对 URL 进行 POST 请求时:

转载 作者:可可西里 更新时间:2023-11-01 16:40:48 29 4
gpt4 key购买 nike

我使用 Falcon 实现了一个 API,它使用 multipart/form 将文件上传到我的服务器。当文件很小 (~1MB) 时,POST 请求工作正常。但是当文件很大(~20MB)时,POST 失败并出现以下错误。

关于如何解决此问题的任何反馈?

错误:

http: error: ConnectionError: ('Connection aborted.', error(32, 'Broken pipe')) while doing POST request to URL: http://...:49160/api/upload

这是我的请求命令行:使用 httpie:

http -f POST http://111.111.111.111:49160/api/upload filename=video.mp4 file@/home/chacon/video.mp4

这是我的 on_post 函数:

def on_post(self, req, resp):


in_file = req.get_param('file')

in_video_name = in_file.filename

source_video_path = os.path.join("/tmp", in_video_name)



#working, but fails for large files

with open(source_video_path, 'wb') as source_video_file:

source_video_file.write(in_file.file.read())

谢谢,

卡洛斯

最佳答案

这是 gunicorn worker 超时的问题。当您启动 gunicorn 时,您可以将超时指定为参数以使其更长,并为文件完成上传提供足够的时间

关于python - http: error: ConnectionError: ('Connection aborted.' , error(32, 'Broken pipe' )) 对 URL 进行 POST 请求时:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41375900/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com