Dropbox API V2 Using Python uploaded large files

I am trying to upload a large file (~900MB) via Dropbox API v2 but I am getting this error:

< p>requests.exceptions.ConnectionError: (‘Connection aborted.’,
ConnectionResetError(104,’Connection reset by peer’))

It is suitable for smaller files.< /p>

I found in the document that I need to use the files_upload_session_start method to open the upload session, but I have an error with this command, and I cannot continue to use the.._ append method.

How do I solve this problem ? There is no information in the document.
I am using Python 3.5.1 and the latest dropbox module installed using pip.

This is the code I am running:

c = Dropbox(access_token)
f = open("D:\Programs\ubuntu-13.10-desktop-amd64.iso", "rb")
result = c.files_upload_session_start( f)
f.seek(0, os.SEEK_END)
size = f.tell()
c.files_upload_session_finish(f, files.UploadSessionCursor(result.session_id, size), files. CommitInfo("/test900.iso"))

For large files like this, you need to use Upload session. Otherwise, you will encounter problems such as the error you posted.

This uses the Dropbox Python SDK to upload the file from the local file specified by the file path to the Dropbox API to the dest_path specified It also chooses whether to use the upload session according to the file size:

f = open(file_path)
file_size = os.path.getsize(file_path)< br />
CHUNK_SIZE = 4 * 1024 * 1024

if file_size <= CHUNK_SIZE:

print dbx.files_upload(f, dest_path)
< br />else:

upload_session_start_result = dbx.files_upload_session_start(f.read(CHUNK_SIZE))
cursor = dropbox.files.UploadSessionCursor(se ssion_id=upload_session_start_result.session_id,
offset=f.tell())
commit = dropbox.files.CommitInfo(path=dest_path)

while f.tell() if ((file_size-f.tell()) <= CHUNK_SIZE):
print dbx.files_upload_session_finish(f.read(CHUNK_SIZE),
cursor,
commit)< br /> else:
dbx.files_upload_session_append(f.read(CHUNK_SIZE),
cursor.session_id,
cursor.offset)
cursor.offset = f.tell()< /pre>

I am trying to upload a large file (~900MB) via Dropbox API v2 but I am getting this error:

< blockquote>

requests.exceptions.ConnectionError: ('Connection aborted.',
ConnectionResetError(104,'Connection reset by peer'))

It is suitable for smaller File.

I found in the document that I need to use files_u The pload_session_start method opens the upload session, but I have an error with this command, and I cannot continue to use the.._ append method.

How can I solve this problem? There is no information in the document.
I am using Python 3.5.1 and the latest dropbox module installed using pip.

This is the code I am running:

c = Dropbox(access_token)
f = open("D:\Programs\ubuntu-13.10-desktop-amd64.iso", "rb")
result = c.files_upload_session_start( f)
f.seek(0, os.SEEK_END)
size = f.tell()
c.files_upload_session_finish(f, files.UploadSessionCursor(result.session_id, size), files. CommitInfo("/test900.iso"))

For large files like this, you need to use the upload session. Otherwise, you will encounter issues such as

This uses the Dropbox Python SDK to upload files from the local file specified by the file path to the remote path specified by the Dropbox API to the remote path specified by dest_path. It also chooses whether to use according to the file size Upload session:

f = open(file_path)
file_size = os.path.getsize(file_path)

CHUNK_SIZE = 4 * 1024 * 1024

if file_size <= CHUNK_SIZE:

print dbx.files_upload(f, dest_path)

else:

upload_session_start_result = dbx.files_upload_session_start(f.read(CHUNK_SIZE))
cursor = dropbox.files.UploadSessionCursor(session_id=upload_session_start_result.session_id,
offset=f.tell())
commit = dropbox.files.CommitInfo(path=dest_path)

while f.tell() if ((file_size- f.tell()) <= CHUNK_SIZE):
print dbx.files_upload_session_finish(f.read(CHUNK_SIZE),
cursor,
commit)
else:
dbx .files_upload_session_append(f.read(CHUNK_SIZE),
cursor.session_id,
cursor.offset)
cursor.offset = f.tell()

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1898 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.