omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    dropboxsync.py dropbox
    4
    6
    8183
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • db2
      db2 last edited by

      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".

      1 Reply Last reply Reply Quote 0
      • KainokiKaede166
        KainokiKaede166 last edited by KainokiKaede166

        I suffered the same problem and here are my quick & dirty fix: dropboxlogin.py and DropboxSync.py .

        Mainly there are three fixes:

        1. 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.
        2. In Python 3, pickle.dumps method returns bytes, not string. So convert to csv.
        3. 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.

        1 Reply Last reply Reply Quote 1
        • db2
          db2 last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • KainokiKaede166
            KainokiKaede166 last edited by

            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!

            Amenbochan 1 Reply Last reply Reply Quote 0
            • Sean
              Sean last edited by

              @KainokiKaede166 Thanks, it works just perfect.

              1 Reply Last reply Reply Quote 0
              • Amenbochan
                Amenbochan @KainokiKaede166 last edited by

                @KainokiKaede166 Thanks.

                I suppose at the 135th line of your DropboxSyncv2.py

                wrong: dropboxlogin3v2
                correct: dropboxloginv2

                And, 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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors