Download pieces using dropbox api

I use the Dropbox API to upload files to a piece. But the following code gets stuck in uploader.upload_chunked (). What could be the reason?

Also, is there a way to find out what is going on in the background, for example, loading these many pieces, still loading, time taken to get the downloaded fragments and other information? Is it possible to use threads to load these pieces, assuming the API takes steps to assemble the blocks in the correct order, or should we take care of an ordered assembly?

import dropbox size = 941 access_token = 'xxx' client = dropbox.client.DropboxClient(access_token) to_upload_file = open('dummy.txt','r') uploader = client.get_chunked_uploader(to_upload_file,size) print 'uploading ', size while uploader.offset < size : try: upload = uploader.upload_chunked(chunk_size=100) print '100 bytes of chunk sent.' except dropbox.rest.ErrorResponse,e: print 'something went wrong' uploader.finish('/dummy.txt') 

Edit :
size = 941 File size to download
upload=uploader.upload_chunked(chunk_size=100) > chunk_size changed from default to 100 bytes
print'100 bytes of chunk sent' β†’ print request included

+6
source share
2 answers

I had the same problem, so I asked the Dropbox developer forum. They suggest upload_chunk (DropboxClient member function, not the one of ChunkedUploader) can meet our requirement

+4
source

upload_chunked downloads the entire file (one fragment at a time), therefore, if an error does not occur, the above code should only appear after the print statement after the file is downloaded.

See https://www.dropbox.com/developers/core/docs/python#ChunkedUploader.upload_chunked for upload_chunked documentation.

+2
source

All Articles