如何使用python在www.example.com上仅访问文件的shared_link权限Box.com?

waxmsbnn  于 2023-05-05  发布在  Python
关注(0)|答案(1)|浏览(122)

我正在尝试查找shared_link权限为False的文件。

file1 = user_client.file(file_id).get()

shared_link =file1.shared_link
permissions = shared_link.permissions

if permissions == False:
    print(f'File "{file1.name}" is not downloadable')
else:
    pass

我希望“此文件不可下载”,但得到了这个:

Exception has occurred: AttributeError
'dict' object has no attribute 'permissions'
File "/Users/ianhorn/Documents/Box-Reports/can_download.py", line 38, in \<module\>
permissions = shared_link.permissions
AttributeError: 'dict' object has no attribute 'permissions'
ws51t4hk

ws51t4hk1#

您可以通过调试脚本来获取此变量。在变量中,您将切换打开shared_link变量,然后打开函数变量。
答案是data.shared_link['permissions']['can_download']

相关问题