从python脚本上传文件到我的保管箱 [英] upload file to my dropbox from python script
问题描述
我想将文件从python脚本自动上传到我的保管箱帐户。无论如何,我找不到一个用户/通行证就能做到这一点。我在Dropbox SDK中看到的所有内容都与具有用户交互功能的应用程序有关。我只想做这样的事情:
I want to upload a file from my python script to my dropbox account automatically. I can't find anyway to do this with just a user/pass. Everything I see in the Dropbox SDK is related to an app having user interaction. I just want to do something like this:
https://api-content.dropbox.com/1/files_put/ /?user = me& pass = blah
https://api-content.dropbox.com/1/files_put//?user=me&pass=blah
推荐答案
重要说明::不推荐使用此答案,因为dropbox现在使用v2 API。
请参见 @ SparkAndShine (用于当前的API版本解决方案)
Important Note: this answer is deprecated since dropbox uses v2 API now.
See the answer of @SparkAndShine for current API version solution
感谢@smarx提供以上答案!我只想向其他尝试这样做的人澄清一下。
Thanks to @smarx for the answer above! I just wanted to clarify for anyone else trying to do this.
-
当然,请务必先安装Dropbox模块,
pip install dropbox
。
在应用程序控制台中使用自己的保管箱帐户创建一个应用程序。 ( https://www.dropbox.com/developers/apps )
Create an app under your own dropbox account in the "App Console". (https://www.dropbox.com/developers/apps)
仅出于记录目的,我使用以下内容创建了我的App:
Just for the record I created my App with the following:
a。应用类型为 Dropbox API应用。
a. App Type as "Dropbox API APP".
b。数据访问类型为文件和数据存储
b. Type of data access as "Files & Datastores"
c。文件夹访问为我的应用程序需要访问Dropbox上已存在的文件。 (即:权限类型为 Full Dropbox。)
c. Folder access as "My app needs access to files already on Dropbox". (ie: Permission Type as "Full Dropbox".)
然后单击生成访问令牌按钮,然后将其剪切/粘贴到下面的python示例中的< auth_token>
:
Then click the "generate access token" button and cut/paste into the python example below in place of <auth_token>
:
这篇关于从python脚本上传文件到我的保管箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!