我正在尝试将带有子文件夹的大型Dropbox文件夹下载到外部硬盘驱动器 在以下位置使用脚本:http://tilburgsciencehub.com/examples/dropbox/
import dropbox
from get_dropbox import get_folders, get_files
from dropbox.exceptions import ApiError, AuthError
# read access token
access_token = "sl.superlongstring"
print('Authenticating with Dropbox...')
try:
dbx = dropbox.Dropbox(access_token, scope=['files.content.read', 'files.metadata.read'])
print('...authenticated with Dropbox owned by ' + dbx.users_get_current_account().name.display_name)
except AuthError as err:
print(err)
这里没有错误,可以正确显示我的名字。
try:
folders=get_folders(dbx, '/Audioboeken')
print(folders)
download_dir = r'L:\\00 Audioboeken'
print('Obtaining list of files in target directory...')
get_files(dbx, folder_id, download_dir)
except ApiError as err:
print(err)
except AuthError as autherr:
print(autherr)
此错误:
dropbox.exceptions.AuthError:AuthError('randomstringofnumbers,AuthError('missing_scope',TokenScopeError(required_scope ='files.metadata.read')))
我尝试将范围添加到登录请求中,但这似乎无济于事。(不确定我是否正确执行了操作
应用程序权限:files.content.read和files.metadata.read的复选框已选中。
答案 0 :(得分:5)
“ missing_scope”错误表明,虽然允许该应用使用该范围,但用于进行API调用的特定访问令牌没有授予该范围。通过“应用程序控制台”将范围添加到您的应用程序不会将该范围追溯授予现有的访问令牌。
在这种情况下,要进行任何需要该作用域的API调用,您将需要获取具有该作用域的新访问令牌。