Closed alicera closed 2 years ago
You can find all of the example code for the Python SDK here: https://github.com/dropbox/dropbox-sdk-python/tree/main/example That doesn't include anything written specifically for Business teams though.
Is there some functionality in particular that you're having trouble with? If so, please share the details so we can take a look.
https://qiita.com/tksnino/items/ee624221d3da00c89005 This code work for me. But change the member to team, it doesnt work. Could you fix the code for team? I appreciate your help very much
Can you clarify what you mean when you say you "change the member to team, it doesnt work"? Please show the specific code you're running and whatever unexpected error or output you're getting.
If I create a folder, dropbox will show only you or specific user.
Assume the work team name work_team. If I crate a folder, dropbox will show the work_team or specific user
like this
Now I put the data into the public folder and run the project(# https://qiita.com/tksnino/items/ee624221d3da00c89005). I can't search the folder "public". But I can search the folder "private".
res = self .dbx.files_list_folder( self .DB_ROOT_DIR, recursive = True )
.local/lib/python3.8/site-packages/dropbox/base.py", line 1952, in files_list_folder
r = self.request(
File "/home/test/.local/lib/python3.8/site-packages /dropbox/dropbox_client.py", line 348, in request
raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('74923a3b6e1', ListFolderError('path', LookupError('not_found', None)))
It looks like you're referring to accessing the contents of the "team space", instead of just the "member folder". By default, Dropbox API calls operate in the "member folder", not the "team space", but you can configure them to operate in the team space when desired, by setting the "Dropbox-API-Path-Root" header. For information on how to do so, please refer to the Team Files Guide:
https://developers.dropbox.com/dbx-team-files-guide
With the Python SDK in particular, you can set that header by using the with_path_root
method:
That would look like this (with root_namespace_id
and path
being your relevant values):
dbx.with_path_root(dropbox.common.PathRoot.root(root_namespace_id)).files_list_folder(path)
I got it to work with a Dropbox Business account thanks to this trick. The issue I was facing is that indeed, the default root dir is the user's home folder, so all Team Shared folders standing side by side with the user home folder became invisible. This was to me unintuitive, since they are perfectly visible in the dropbox web GUI https://www.dropbox.com/work
I found the root_namespace_id
by running the API function users_get_current_account()
and fetching the root_info.root_namespace_id
attribute of the result of the call. This call works as long as the team_data.member
permission is not granted in the Team Scopes section of the Permission tab in the application dashboard (available at https://www.dropbox.com/developers/apps/info/<APP_KEY>#permissions
)
Do you have the sample code for team?