如何使用v2 API列出我的保管箱中的所有文件和文件夹 [英] How to list all files and folders in my dropbox using v2 api
问题描述
我正在使用Python SDK,并希望检索我所有的保管箱文件和文件夹。
I am using Python SDK and would like to retrieve all of my dropbox files and folders.
我正在使用Dropbox的Python SDK v2。
I am using v2 of Python SDK of Dropbox.
dbx = Dropbox("DROBOX_ACCESS_TOKEN")
response = dbx.files_list_folder("/Apps/Marketing")
for file in response.entries:
print file.name
但是,我得到一个错误:
However, I get an error:
dropbox.exceptions.ApiError: ApiError('b0479a07aaa5a9b405862ae75cbf135d', ListFolderError(u'path', LookupError(u'not_found', None)))
当我登录时Dropbox中存在Apps文件夹(根文件夹中的问题)
While Apps folder exists in Dropbox when I login (prob in root folder)
当我尝试使用空路径列出以获取根文件夹文件夹时:
When I try to list with empty path in order to get root folder folders:
response = dbx.files_list_folder("")
响应条目为空。
如何在Dropbox V2 API中检索所有文件和文件夹的列表?
How can I retrieve the list of all files and folders in dropbox v2 api?
令牌是一个我在Dropbox的OAuth 2设置中生成了。
The token is the one I generated in OAuth 2 settings in dropbox.
,我给令牌App文件夹访问了Apps下名为Marketing的文件夹。
and I gave the token App folder access to a folder under Apps called Marketing.
推荐答案
我正在使用Python SDK,并且想检索我所有的保管箱文件和文件夹。
...
,然后我给令牌App文件夹访问了应用程序下名为
Marketing的文件夹。
I am using Python SDK and would like to retrieve all of my dropbox files and folders.
...
and I gave the token App folder access to a folder under Apps called Marketing.
您应该已经为您的应用指定了完整Dropbox 访问类型。使用应用文件夹访问类型,您的应用将自动限制为应用
下的相应文件夹,因此所有路径都传递给在该应用程序下运行的files_list_folder()
相对于您应用程序的专用文件夹进行解释。
You should have given your app Full Dropbox access type. With App Folder access type, your app is automatically restricted to the corresponding folder under Apps
, and hence all paths passed to files_list_folder()
running under that app are interpreted relative to your app's dedicated folder.
这篇关于如何使用v2 API列出我的保管箱中的所有文件和文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!