我一直在研究 Dropbox API 的文档,但找不到一种无需进入 OAuth 流程即可直接访问帐户的方法。有办法实现吗?
我的最终目标是拥有一个网页,其中包含来自特定 Dropbox 帐户(我自己的)的文件和文件夹列表,任何人都可以查看和下载。
在Dropbox SDK 2.0中,有没有办法检查文件夹是否存在?或者我们是否使用列出文件夹然后扫描列表的强力方法?
我是一名新开发人员,正在学习使用 Python 3.4.2 进行编码。我在 Raspberry Pi3 上运行 Debian Linux。全新安装后我都做了
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
和
sudo apt-get upgrade
Run Code Online (Sandbox Code Playgroud)
让一切都是最新的。
我正在尝试测试将文件上传到 Dropbox 的一段代码:
import dropbox
import urllib3
authkey = (my dropbox dev auth key)
with open('test.csv','rb') as f:
dbx = dropbox.Dropbox(authkey)
dbx.files_upload(f.read(), '/test.csv')
Run Code Online (Sandbox Code Playgroud)
现在,我不知道实际的 Dropbox 代码是否正确,因为当我在 Python shell 中运行脚本时收到以下错误:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 58, in <module>
assert minor >= 21
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/dbtest.py", line 1, …Run Code Online (Sandbox Code Playgroud) 以前,我在网络应用程序中使用Dropbox API V1来上传我的 Dropbox 帐户的文件。请注意,该应用程序仅使用一个 Dropbox 帐户(我的)来上传文件。
所以以前:
这之前工作得很好,但由于 dropbox API v1 已被弃用,它不再工作了。
Dropbox V1 代码:
function fileupload(content) {
request.put('https://api-content.dropbox.com/1/files_put/auto/my_reports/report.pdf', {
headers: {
Authorization: 'TOKEN HERE',
'Content-Type': 'application/pdf'
},
body: content
}, function optionalCallback(err, httpResponse, bodymsg) {
if (err) {
console.log(err);
}
else {
console.log("File uploaded to dropbox successfully!");
fs.unlink(temp_dir + 'report.pdf', function(err) {
if (err)
throw err;
else {
console.log("file deleted from server!");
}
})
request.post('https://api.dropboxapi.com/1/shares/auto/MY_reports/report.pdf' + '?short_url=false', {
headers: …Run Code Online (Sandbox Code Playgroud) 这类似于我之前的问题: 从 Dropbox 上的公共共享文件夹下载图像
我有这段代码(简化版),需要从公共共享文件夹和所有子文件夹下载所有图像。
using Dropbox.Api;
using Dropbox.Api.Files;
...
// AccessToken - get it from app console
// FolderToDownload - https://www.dropbox.com/sh/{unicorn_string}?dl=0
using (var dbx = new DropboxClient(_dropboxSettings.AccessToken))
{
var sharedLink = new SharedLink(_dropboxSettings.FolderToDownload);
var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink);
// var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink, recursive: true);
// "recursive: true" throws: Error in call to API function "files/list_folder": Recursive list folder is not supported for shared link.
foreach (var entry in sharedFiles.Entries)
{
if …Run Code Online (Sandbox Code Playgroud) 首先我要说的是,Dropbox 对 Linux 的支持需要认真改进!我花了半天时间才弄清楚如何在RHEL上安装它而且只是命令行界面(甚至不知道是否有GUI)。
现在安装完毕后,我发现它似乎无法正常工作:( 我正在使用推荐的 python 控件,当我输入
dropbox exclude add test_folder
Run Code Online (Sandbox Code Playgroud)
它确实从列表中删除了该文件夹。然而,我无法把它拿回来。当我检查排除列表时,它显示“没有目录被忽略”。因此,我无法通过 重新添加它exclude remove。当我在线登录时,我可以看到该文件夹仍然存在,但我无法将其添加回本地计算机。
我错过了什么吗?
Dropbox daemon version: 124.4.4912
Dropbox command-line interface version: 2020.03.04
Run Code Online (Sandbox Code Playgroud) 有人可以展示一些关于使用django的dropbox api的例子吗?安装Dropbox api,自述完成,测试完成,如何进一步完成?
是否可以使用http put方法将本地文件上传到Dropbox?我正在上传一个文件,但它没有正文?("字节":0)
如何在文件中添加内容?
我的代码如下:
$scope.uploadHtmlFile = function() {
$http({
method: 'PUT',
url: 'https://api-content.dropbox.com/1/files_put/dropbox/test.txt?access_token='+ localStorage.getItem('accessToken')
}).success(function(data,status,headers,config){
console.log(data);
console.log('file uploaded successfully');
}).error(function(data,status,headers,config){
});
}
Run Code Online (Sandbox Code Playgroud)
我的文件已成功上传,但没有内容?它是空的!! 文档对我来说有点混乱:https://www.dropbox.com/developers/core/docs#files_put
通过Dropbox oAuth2 API获取的访问令牌的生命周期是多少?
https://api.dropbox.com/1/oauth2/token之后的答案是这样的
{
"access_token": "fHUlx32x494RmgTlxWiF6pLzd5q1Lg4Itt7I6itVYDIDT",
"token_type": "bearer",
"uid": "17233223324"
}
Run Code Online (Sandbox Code Playgroud)
但是没有提到AT什么时候到期.如果曾经.
我尝试从localhost访问我的Dropbox应用程序,从那里下载图像.出现选择器的弹出窗口,但是出现错误:
Origin与任何应用程序域都不匹配
脚本
<div id="container"><a id="link"></a></div>
<script>
var button = Dropbox.createChooseButton({
success: function (files) {
var linkTag = document.getElementById('link');
linkTag.href = files[0].link;
linkTag.textContent = files[0].link;
},
linkType: 'direct'
});
document.getElementById('container').appendChild(button);
</script>
Run Code Online (Sandbox Code Playgroud)
我在dropbox上生成了包含app-key的dropins.js.
设置Dropbox
OAUTH2重定向URI设置为
http://127.0.0.1:8020/
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?我还是经常尝试:
dropbox-api ×10
dropbox ×6
javascript ×3
angularjs ×1
bash ×1
c# ×1
django ×1
dropbox-php ×1
dropbox-sdk ×1
linux ×1
node.js ×1
oauth-2.0 ×1
python-3.x ×1
rhel ×1
rhel8 ×1
urllib3 ×1