2017-07-10 3 views
0

Hallo Leute zu Dropbox, Ich versuche, eine Datei zu senden mit thise Code zu Dropbox:Fehler bei Datei Senden

import dropbox 

f = open('test.txt') 

dbx = dropbox.Dropbox('ACCESS TOKEN') 

dbx.files_upload(f, '/uploaded.csv') 

f.close() 

Aber ich habe diese Fehlermeldung:

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'> 

Weiß jemand, was ich falsch mache? Vielen Dank im Voraus

Antwort

0

Sieht aus wie Sie Ihre App nicht korrekt authentifiziert werden?

# 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) 

https://www.dropbox.com/developers-v1/core/start/python