嗨,大家好, 我正在尝试使用以下代码将文件发送到Dropbox:
import dropbox
f = open('test.txt')
dbx = dropbox.Dropbox('ACCESS TOKEN')
dbx.files_upload(f, '/uploaded.csv')
f.close()
但是,我收到此错误消息:
Traceback (most recent call last):
File "C:\Users\Erim\Desktop\aa.py", line 7, in <module>
dbx.files_upload(f, '/uploaded.csv')
File "C:\Users\Erim\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\base.py", line 1267, in files_upload
f,
File "C:\Users\Erim\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\dropbox.py", line 234, in request
timeout=timeout)
File "C:\Users\Erim\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\dropbox.py", line 325, in request_json_string_with_retry
timeout=timeout)
File "C:\Users\Erim\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\dropbox.py", line 369, in request_json_string
type(request_binary))
TypeError: expected request_binary as binary type, got <class '_io.TextIOWrapper'>
有谁知道我做错了什么? 提前感谢
答案 0 :(得分:0)
您似乎没有正确验证自己的应用?
# Include the Dropbox SDK
import dropbox
# Get your app key and secret from the Dropbox developer website
app_key = 'INSERT_APP_KEY'
app_secret = 'INSERT_APP_SECRET'
flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)