大文件保管箱上传 APIv2 python

Large file dropbox upload APIv2 python

我正在做一个学校项目,其中一个摄像头录制视频然后将其上传到 Dropbox,遗憾的是我在上传相当大的文件时遇到了问题,该文件大约 172Mb。

dropboxServer = dropbox.Dropbox(token)
with open(filename,'rb') as file:
    response = dropboxServer.file_upload(file.read(),'/Videos/'+filename)
    print("Upload:"+response)

错误: https://pastebin.com/W8NS6BeY

上传文件前您的连接超时。

提供者:socket.timeout: The write operation timed out 来自您的回溯。

要解决此问题,您可以在创建 Dropbox 对象时设置(覆盖默认的 30 秒)超时,请在此处查看更多信息:module-dropbox.dropbox

根据 files_upload 的文档,对于像这样的大文件 (>150 MB),您应该改用上传会话:

Do not use this to upload a file larger than 150 MB. Instead, create an upload session with files_upload_session_start().

@chjortlund 感谢您的帮助!我真的很感激 :D 我所做的只是更改 dropboxServer 对象中的超时变量

dropboxSever._timeout = number