如何使用 Dropbox python API 获取文件的浏览器视图文件链接?

问题描述 投票:0回答:1

我正在使用 dropbox 的 python api,我的问题与 this 相同,除了我想获取一个在浏览器中显示图像的链接。不是下载文件的链接。

所以我有一个 FileMetaData 对象,我想要一个链接(例如以 dropbox.com 开头的链接...),用于在浏览器中打开图像。不是预览链接。在浏览器中看起来像这样 enter image description here

我该怎么做?

该链接由以下部分组成: dropbox.com/scl/fi/[random_letters_numbers]/[file_name]?rlkey=[random_letters_numbers]&e=2&st=[random_letters_numbers]

我也不希望这个链接过期。

python dropbox-api dropbox-sdk
1个回答
0
投票

要创建链接,请使用以下命令:

dbx.sharing_create_shared_link_with_settings(myFileMetaDataObj.path_display)

但是,如果您已经为其创建了链接,这将导致错误。

要检查链接是否存在,请使用:

dbx.sharing_list_shared_links(entry.path_display)

© www.soinside.com 2019 - 2024. All rights reserved.