Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
"Request token not found" from Dropbox sync in Pythonista 3
-
Just bought and installed Pythonista 3, and the first thing I'm trying to do is move over the usual Dropbox sync script. I ran both dropboxlogin.py and dropboxsync.py through the 2to3 converter (which mostly just cleaned up print statements), and now I get this error from dropboxlogin.py:
[401] 'Request token not found.'
This is from line 34,
request_token = get_request_token()
. Did something in the Dropbox API change in P3, and does dropboxlogin.py need to be updated accordingly? Peeking at the locals in the exception window shows that "request_token" on the DropboxSession object is "None". -
I suffered the same problem and here are my quick & dirty fix: dropboxlogin.py and DropboxSync.py .
Mainly there are three fixes:
- In Python 3,
dropbox
module seems to receive tokens in bytes, but somehow doesn't accept them in bytes. So decode them into ascii codec. - In Python 3,
pickle.dumps
method returns bytes, not string. So convert to csv. dropbox
module now gives files in bytes, so receive them in bytes.
Now those codes are running fine on my Pythonista 3 but I think it's high time we migrated to API v2.
- In Python 3,
-
Excellent, that seems to have me up and running again. Thanks.
Must be fallout from Python 3 having better support for Unicode and other character encodings.
-
I edited those two codes to use DropBox API v2: dropboxloginv2.py and DropboxSyncv2.py .
Now that API v1 is deprecated, you'd better use those new codes.
They are working well on my Pythonista 3, but not well tested.
If you notice any bugs, please fork the codes and fix them! -
@KainokiKaede166 Thanks, it works just perfect.
-
@KainokiKaede166 Thanks.
I suppose at the 135th line of your DropboxSyncv2.py
wrong: dropboxlogin3v2
correct: dropboxloginv2And, I can't delete a folder from my Dropbox, that has been deleted from Pythonista. Files in the folder can be deleted, but the folder itself can't.
Sorry about my poor English.