You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

ankit_goyal's avatar
ankit_goyal
Explorer | Level 3
7 years ago

Upload session api creating empty files

import requests import json class DropboxUtil: _token = None _logger = None UPLOAD_SIZE = 149 * 1024 * 1024 def __init__(self, token): DropboxUtil._token = "Bearer ...
  • Greg-DB's avatar
    7 years ago

    I see from your code that you're only sending data with the append call. You can actually send data on any/all of the start, append, and finish calls, though it's not required. (Also, for small uploads like this, you don't need to use upload sessions at all, but I presume this is just for the sake of testing the code during development.)

    Anyway, you are sending data with the append call, but you aren't checking if that call is succeeding. You should check the result and add some error handling around the append call. You can check success via the returned status code, and check the response body for more information.

    I suspect the underlying issue is due to your "offset" handling, and is being obscured by the lack of response/error handling for the append call. Specifically, the "offset" you supply should be "The amount of data that has been uploaded so far" (for the upload session overall), not how much you're sending in the current request, as you appear to have in your code with `len(data)`.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 11 hours ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!