<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic downloading a large file using python v2 API in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179392#M7270</link>
    <description>&lt;P&gt;Dear Dropboxers,&lt;/P&gt;
&lt;P&gt;would it be possible to see an example for large file download, equivalent to&amp;nbsp;&lt;A href="https://www.dropboxforum.com/hc/en-us/community/posts/205544836-python-upload-big-file-example" rel="nofollow noreferrer" target="_blank"&gt;https://www.dropboxforum.com/hc/en-us/community/posts/205544836-python-upload-big-file-example&lt;/A&gt; for the upload?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:31:21 GMT</pubDate>
    <dc:creator>Olaf B.2</dc:creator>
    <dc:date>2019-05-29T09:31:21Z</dc:date>
    <item>
      <title>downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179392#M7270</link>
      <description>&lt;P&gt;Dear Dropboxers,&lt;/P&gt;
&lt;P&gt;would it be possible to see an example for large file download, equivalent to&amp;nbsp;&lt;A href="https://www.dropboxforum.com/hc/en-us/community/posts/205544836-python-upload-big-file-example" rel="nofollow noreferrer" target="_blank"&gt;https://www.dropboxforum.com/hc/en-us/community/posts/205544836-python-upload-big-file-example&lt;/A&gt; for the upload?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:31:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179392#M7270</guid>
      <dc:creator>Olaf B.2</dc:creator>
      <dc:date>2019-05-29T09:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179393#M7271</link>
      <description>&lt;P&gt;Hi Olaf, for downloading, you generally just need a simple call to the files_download method. There's a sample here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/documentation/dropbox-api/408/downloading-a-file/1350/downloading-a-file-using-the-dropbox-python-library#t=201607262010533665443" rel="nofollow noreferrer"&gt;https://stackoverflow.com/documentation/dropbox-api/408/downloading-a-file/1350/downloading-a-file-using-the-dropbox-python-library#t=201607262010533665443&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Are you running into issues downloading large files?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 03:13:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179393#M7271</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-27T03:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179394#M7272</link>
      <description>&lt;P&gt;Hi Gregory,&lt;/P&gt;
&lt;P&gt;thanks. I am working with very large files, up to several tens of GB, and it would be nice to be able to parcel them in chunks, as we do for the upload. The motivation is the same: to be able to monitor progress and retry in the case of failure. I cannot find the the right tools for that in the API. Are they not provided, or am I looking in the wrong place?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 23:34:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179394#M7272</guid>
      <dc:creator>Olaf B.2</dc:creator>
      <dc:date>2016-07-27T23:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179395#M7273</link>
      <description>&lt;P&gt;I see, thanks for the additional context! The API itself does actually support &lt;A href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2" target="_blank" rel="nofollow noreferrer"&gt;Range Retrieval Requests&lt;/A&gt; which can be used to download files in pieces, but this functionality unfortunately isn't currently exposed in the API v2 Python SDK. We'll consider this a feature request for that though.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:27:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179395#M7273</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-28T01:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179396#M7274</link>
      <description>&lt;P&gt;Is it available in some other programing language?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 03:37:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179396#M7274</guid>
      <dc:creator>Olaf B.2</dc:creator>
      <dc:date>2016-07-28T03:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179397#M7275</link>
      <description>&lt;P&gt;It is already &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/DbxDownloadStyleBuilder.html#range-long-" target="_blank" rel="nofollow noreferrer"&gt;implemented&amp;nbsp;in the Java SDK&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(It is also &lt;A href="https://www.dropbox.com/developers-v1/core/docs/python#DropboxClient.get_file" target="_blank" rel="nofollow noreferrer"&gt;implemented in the API v1 Python client&lt;/A&gt;, but I can't&amp;nbsp;recommend using that as &lt;A href="https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/" target="_blank" rel="nofollow noreferrer"&gt;it's deprecated&lt;/A&gt;.)&lt;/P&gt;
&lt;P&gt;If you wanted to implement it manually, or modify the Python SDK, here's a sample of what it would look like in curl for reference:&lt;/P&gt;
&lt;PRE&gt;curl -X POST https://content.dropboxapi.com/2/files/download \&lt;BR /&gt; --header "Authorization: Bearer ACCESS_TOKEN" \&lt;BR /&gt; --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}" \&lt;BR /&gt; --header "Range:bytes=0-2"&lt;/PRE&gt;
&lt;P&gt;That would download just the first 3 bytes of the file at /test.txt.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 04:23:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179397#M7275</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-28T04:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179398#M7276</link>
      <description>&lt;P&gt;OK, thank you, this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 04:59:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179398#M7276</guid>
      <dc:creator>Olaf B.2</dc:creator>
      <dc:date>2016-07-28T04:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179399#M7277</link>
      <description>&lt;P&gt;I have the same problem - want to download a very large file in a streaming format in the v2 API and used to use v1 "get_file()" functionality. The idea is to use it for a "tar" restore from backup, and pulling it all into memory ala "files_download()"&amp;nbsp;would get ugly fast.&lt;/P&gt;
&lt;P&gt;Any hope that this will make it back into the exposed Python API?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 01:23:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179399#M7277</guid>
      <dc:creator>MattFahrner</dc:creator>
      <dc:date>2016-09-25T01:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179400#M7278</link>
      <description>&lt;P&gt;Hi Matt, it sounds like your request may actually be slightly different than what was being discussed on this thread. We were talking about downloading files in distinct chunks&amp;nbsp;(similar to the chunked upload), but it sounds like you want to be able to stream the download as desired, like you currently do with the get_file method.&lt;/P&gt;
&lt;P&gt;I believe the&amp;nbsp;files_download method does already work the same way as that though. It returns a&amp;nbsp;requests.models.Response object on which you can call &lt;A href="http://docs.python-requests.org/en/master/api/#requests.Response.iter_content" target="_blank" rel="nofollow noreferrer"&gt;iter_content&lt;/A&gt; to iterate over the content, streaming it off the connection.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would look something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;metadata, res = dbx.files_download(path)&lt;BR /&gt;for data in res.iter_content(10):&lt;BR /&gt; print(data)&lt;/PRE&gt;
&lt;P&gt;Hope this helps!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 02:15:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179400#M7278</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-09-27T02:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179401#M7279</link>
      <description>&lt;P&gt;Excellent! I will give that a try - thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 02:20:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/179401#M7279</guid>
      <dc:creator>MattFahrner</dc:creator>
      <dc:date>2016-09-27T02:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384615#M21390</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;This post is a bit old, but was the incremental download implemented in the v2 Python SDK?&lt;/P&gt;&lt;P&gt;I'm having troubles to manage large accounts (many files and large files) so I'm developing some tools using Python. Downloading large files (&amp;gt;20Gb) using the desktop application takes ages and have no control, and even using the navigator there are many interruptions or abortions, so the idea is to have total control about exactly what is being downloaded, and to be able to restart from the last sucessful chunk as needed.&lt;/P&gt;&lt;P&gt;I'm already being able to upload large files using files_upload_session_start/append/finish methods.&lt;/P&gt;&lt;P&gt;Thanks and regards.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 21:15:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384615#M21390</guid>
      <dc:creator>MarceloC</dc:creator>
      <dc:date>2019-12-16T21:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384626#M21392</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/883599"&gt;@MarceloC&lt;/a&gt;&amp;nbsp;No, unfortunately support for Range requests still hasn't been implemented in the&amp;nbsp;Dropbox API v2&amp;nbsp;Python&amp;nbsp;SDK.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 21:48:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384626#M21392</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-12-16T21:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: downloading a large file using python v2 API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384680#M21394</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;P&gt;Thank you for your reply!&lt;/P&gt;&lt;P&gt;Although I'm just starting with Python and still have no much knowledge of it's libraries or objects structure, I tried to implement your suggestion and got to have the partial download working! &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@BEEAA17610EBE252DA0E57250B296A61/images/emoticons/1f642.png" alt=":slight_smile:" title=":slight_smile:" /&gt;&lt;/P&gt;&lt;P&gt;It is just an workaround and very FAR from a proper or elegant solution, but if anyone wants just to make it work, this is what I did... (use under your own responsability!)&lt;/P&gt;&lt;P&gt;As I could not even find from where the &lt;EM&gt;request_json_string&lt;/EM&gt; method (where the header is set) is called to try to include some proper parameters, I just included 2 global variables in the dropbox unit, and created a method to set them from the main program.&lt;/P&gt;&lt;P&gt;In the&amp;nbsp;beginning of the file &lt;STRONG&gt;&lt;EM&gt;dropbox.py&lt;/EM&gt;&lt;/STRONG&gt; (backup it before changing!!) I added the global (in class context) variables: (may be inserted in the first lines of the file)&lt;/P&gt;&lt;PRE&gt;Download_Range_Start=-1
Download_Range_End=-1&lt;/PRE&gt;&lt;P&gt;Just before the &lt;EM&gt;request_json_string&lt;/EM&gt; method definition (line 389 at the original dropbox.py file) I added the method to set the variables:&lt;/P&gt;&lt;PRE&gt;    def set_download_range(self,Start,End):
        global Download_Range_Start, Download_Range_End
        Download_Range_Start=Start
        Download_Range_End=End&lt;/PRE&gt;&lt;P&gt;And, inside the &lt;EM&gt;request_json_string&lt;/EM&gt; method included two lines (the 3rd and 4th lines below - line 433 at the original dropbox.py file):&lt;/P&gt;&lt;PRE&gt;        ...
        elif route_style == self._ROUTE_STYLE_DOWNLOAD:
            headers['Dropbox-API-Arg'] = request_json_arg
&lt;STRONG&gt;            if (Download_Range_Start&amp;gt;=0)and(Download_Range_End&amp;gt;=Download_Range_Start):
                headers['Range'] = 'bytes='+str(Download_Range_Start)+'-'+str(Download_Range_End)&lt;BR /&gt;&lt;/STRONG&gt;            stream = True
        elif route_style == self._ROUTE_STYLE_UPLOAD:
        ...&lt;/PRE&gt;&lt;P&gt;To use just put in your main program before downloading the file: (dbx is the main dropbox object)&lt;/P&gt;&lt;PRE&gt;    dbx.set_download_range(5,10)&lt;/PRE&gt;&lt;P&gt;This will make the download bring from the 6th to the 11th byte from the file (it is 0 based).&lt;/P&gt;&lt;P&gt;As it is using global variables, be careful because this change will affect all downloads done after it, and may persist if the library is retained in the same process (and possibly may affect other threads in the same process, so not recomended for multi-thread apps).&lt;/P&gt;&lt;P&gt;To return to the original condition (no range) use:&lt;/P&gt;&lt;PRE&gt;    dbx.set_download_range(-1,-1)&lt;/PRE&gt;&lt;P&gt;The &lt;EM&gt;Start&lt;/EM&gt; position must be inside the file, to prevent an exception. The &lt;EM&gt;End&lt;/EM&gt; position may be after the file end.&lt;/P&gt;&lt;P&gt;This approach is different than the one for upload, based in a session (appending chunks) controlled by Dropbox server. In this case it is up to you to create and control a "session" in the client side and merge the chunks.&lt;/P&gt;&lt;P&gt;Well, if someone wants to improve and do a more elegant implementation adding parameters to the download methods, please be welcome.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;*I only tested with &lt;/EM&gt;files_download_to_file &lt;EM&gt;method, but probably it will work with &lt;/EM&gt;files_download&lt;EM&gt; as well.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 06:38:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/downloading-a-large-file-using-python-v2-API/m-p/384680#M21394</guid>
      <dc:creator>MarceloC</dc:creator>
      <dc:date>2019-12-17T06:38:10Z</dc:date>
    </item>
  </channel>
</rss>

