<?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 Re: Reading programmatically several files from Dropbox business in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388325#M21536</link>
    <description>&lt;P&gt;Thanks Greg,&lt;/P&gt;&lt;P&gt;By the way I was able to download data from the dropbox by these solutions using following command :&lt;/P&gt;&lt;P&gt;dbx.files_download(path="PATHtoFILE")&lt;/P&gt;&lt;P&gt;However I didn't find a way to only read the document without downloading it. What I want to do is opening a .txt file and read a certain line in it or open a video and get only one frame of it without downloading the whole video. Is there any way to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2020 20:03:19 GMT</pubDate>
    <dc:creator>Aryahagh</dc:creator>
    <dc:date>2020-01-08T20:03:19Z</dc:date>
    <item>
      <title>Reading programmatically several files from Dropbox business</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388297#M21532</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I want to read (or only reading is not possible, download) several files in different folders ,which is stored in a Dropbox buisiness account, programmatically in python. I were able to create an app and using Access Token download data when it was created in regular account, but when I select "Dropbox Business API" while creating a new app it suggesting 4 new options and I tried all of those options but when I tried using Access Token to download the data it gave me BadInputError for example saying ("Since your API app key has team member file access permissions, you can operate on a team member\'s Dropbox by providing the "Dropbox-API-Select-User" HTTP header or "select_user" URL parameter to specify the exact user &amp;lt;&lt;A href="https://www.dropbox.com/developers/documentation/http/teams" target="_blank" rel="noopener"&gt;https://www.dropbox.com/developers/documentation/http/teams&lt;/A&gt;&amp;gt;.")&lt;/P&gt;
&lt;P&gt;How should I manage this problem?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 08:12:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388297#M21532</guid>
      <dc:creator>Aryahagh</dc:creator>
      <dc:date>2020-01-09T08:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading programmatically several files from Dropbox business</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388305#M21535</link>
      <description>&lt;P&gt;If you only want to access the files in one particular account, you can &lt;A href="https://www.dropbox.com/developers/apps/create" target="_self"&gt;register&lt;/A&gt; a "Dropbox API" app with the "Full Dropbox" &lt;A href="https://www.dropbox.com/developers/reference/developer-guide#app-permissions" target="_self"&gt;permission&lt;/A&gt; and then use &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_self"&gt;the /2/files/download endpoint&lt;/A&gt; to download files from a connected account without any extra configuration. (You can also connect the app to multiple different accounts, but each user would need to authorize their own account, to give the app a distinct access token for each one.) That would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curl -X POST https://content.dropboxapi.com/2/files/download \
    --header "Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;" \
    --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, using &lt;A href="https://github.com/dropbox/dropbox-sdk-python" target="_self"&gt;the Python SDK&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx = dropbox.Dropbox(ACCESS_TOKEN)

print(dbx.files_download("/test.txt"))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to be able to access the files any team member's account on a Business team, by only having a team admin authorize the app once, you will need to&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/apps/create" target="_self"&gt;register&lt;/A&gt;&amp;nbsp;a "Dropbox Business API" app with the "team member file access" &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#access-types" target="_self"&gt;permission&lt;/A&gt;&amp;nbsp;and then use &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_self"&gt;the /2/files/download endpoint&lt;/A&gt; to download files, but with some extra configuration as covered in &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access" target="_self"&gt;the "Member file access" section&lt;/A&gt; of the Business API documentation. Since&amp;nbsp;Dropbox Business API apps are connected to the entire Business team, you need to specify which member you want to operate on when making a user-level call, such as &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_blank"&gt;/2/files/download&lt;/A&gt;. You can do so by specifying the&amp;nbsp;Dropbox-API-Select-User" header with the value being the team member ID of the member you want to call for. The team member ID starts with "dbmid:" and can be retrieved from the Dropbox Business API, such as via &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-get_info" target="_self"&gt;/2/team/members/get_info&lt;/A&gt; or&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-list" target="_self"&gt;/2/team/members/list&lt;/A&gt;[&lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-list-continue" target="_self"&gt;/continue&lt;/A&gt;]. That would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curl -X POST https://content.dropboxapi.com/2/files/download \
    --header "Authorization: Bearer &amp;lt;TEAM_ACCESS_TOKEN&amp;gt;" \
    --header "Dropbox-API-Select-Admin: &amp;lt;TEAM_MEMBER_ID&amp;gt;" \
    --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, using &lt;A href="https://github.com/dropbox/dropbox-sdk-python" target="_self"&gt;the Python SDK&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx = dropbox.DropboxTeam(TEAM_ACCESS_TOKEN).as_user(TEAM_MEMBER_ID)

print(dbx.files_download("/test.txt"))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 17:39:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388305#M21535</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-08T17:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reading programmatically several files from Dropbox business</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388325#M21536</link>
      <description>&lt;P&gt;Thanks Greg,&lt;/P&gt;&lt;P&gt;By the way I was able to download data from the dropbox by these solutions using following command :&lt;/P&gt;&lt;P&gt;dbx.files_download(path="PATHtoFILE")&lt;/P&gt;&lt;P&gt;However I didn't find a way to only read the document without downloading it. What I want to do is opening a .txt file and read a certain line in it or open a video and get only one frame of it without downloading the whole video. Is there any way to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 20:03:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388325#M21536</guid>
      <dc:creator>Aryahagh</dc:creator>
      <dc:date>2020-01-08T20:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading programmatically several files from Dropbox business</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388331#M21537</link>
      <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_download" target="_self"&gt;files_download&lt;/A&gt; method returns a tuple of (&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/files.html#dropbox.files.FileMetadata" target="_self"&gt;FileMetadata&lt;/A&gt;,&amp;nbsp;&lt;A href="https://2.python-requests.org/en/master/api/#requests.Response" target="_self"&gt;requests.Response&lt;/A&gt;), so you can get the file data from&amp;nbsp;&lt;A href="https://2.python-requests.org/en/master/api/#requests.Response" target="_self"&gt;requests.Response&lt;/A&gt;&amp;nbsp;using the methods provided by that class.&lt;/P&gt;
&lt;P&gt;For instance, you can stream content from it piece by piece, without downloading the whole thing, using&amp;nbsp;&lt;A href="https://2.python-requests.org/en/master/api/#requests.Response.iter_content" target="_self"&gt;requests.Response.iter_content&lt;/A&gt; and/or&amp;nbsp;&lt;A href="https://2.python-requests.org/en/master/api/#requests.Response.iter_lines" target="_self"&gt;requests.Response.iter_lines&lt;/A&gt;, if those work for your use case. As a contrived example:&lt;/P&gt;
&lt;PRE&gt;metadata, res = dbx.files_download("/test.txt")

for data in res.iter_lines():
    print(data)
    raw_input()&lt;/PRE&gt;
&lt;P&gt;That sounds like that isn't exactly what you're looking for though unfortunately, as the&amp;nbsp;iter_lines method returns a generator that lets you run through the lines; it doesn't let you retrieve a specific line. Likewise,&amp;nbsp;iter_content wouldn't let you retrieve a specific video frame from an arbitrary location in a video file.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 20:21:35 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Reading-programmatically-several-files-from-Dropbox-business/m-p/388331#M21537</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-08T20:21:35Z</dc:date>
    </item>
  </channel>
</rss>

