• MTcoder

    @Phuket2 @cvp @omz Thank you all. I've never seen a community that is as willing to help as this one. Maybe it's because we have such a splendid tool in our hands!

    posted in Pythonista read more
  • MTcoder

    I was so happy to find this reference to PyPDF2, and even happier to find it is included with Pythonista. Looks like just what I need.

    But how, may I ask (and maybe it is just way too late at night and my brain is shot) did you all know that it was included? It's not listed in the Globule Module Index.

    I did find the source in the included libraries. Is that the best place to be looking?

    Thanks, all.

    posted in Pythonista read more
  • MTcoder

    @omz atexit seems to work fine in Pythonista 3 -- is it true? Has this issue been solved?

    posted in Pythonista read more
  • MTcoder

    @omz Thank you!

    Is this current forum the correct place to post things like this that may not be working as expected? I like to have an issue reviewed/corroborated/explained away by other users before it is deemed a bug.

    posted in Pythonista read more
  • MTcoder

    I use Quick Help by highlighting a command or function etc. and selecting "Help..." from the menu very frequently. It is one of the best features of the editor, saving so much time compared to shifting to the console help feature.

    However, I always get "No Results" in the popup box now, no matter what I try.

    Is anyone else using this? Am I the only one not seeing documentation in the popup box?

    posted in Pythonista read more
  • MTcoder

    @ccc said:

    Pythonista is based on CPython 2.7.5 but the current CPython is 2.7.11. It you go back and read the URLs that you provided above, you will see that urllib3 warns you if you are doing certain things with CPython versions prior to 2.7.9.

    Thank you for the version numbers -- that explains a lot. I reported this since these exceptions were not popping up in Pythonista 2.0 but started with 2.1. I'm upgrading code to Dropbox v2, but will just disable these warnings in the current v1 code.

    posted in Pythonista read more
  • MTcoder

    @SimCityWok Since you have your access token you should be in good shape, especially with Pythonista 2.1.

    Take a look at Dropbox API Explorer in the Dropbox developer's area. It allows you to play and access your dropbox and generate code with just your token in hand.

    Good luck -- I hope you can get in again.

    posted in Pythonista read more
  • MTcoder

    I am sure the ultimate answer is to get things upgraded to Dropbox API v2 but wanted to report this just in case.

    @ccc Disable warnings -- that, too.

    posted in Pythonista read more
  • MTcoder

    @omz I am getting the following exceptions from Dropbox scripts running on Pythonista 2.1. They were running without error yesterday on Pythonista 2.0. I am using an iPad with iOS 9.3.2.

    Is anyone else seeing this?

    /var/containers/Bundle/Application/0A6E6890-4845-449B-9931-B5845AF8878F/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/site-packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
    /var/containers/Bundle/Application/0A6E6890-4845-449B-9931-B5845AF8878F/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/site-packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning

    Ironically it says to use a newer version of Python, but that is what has raised these exceptions.

    Here is the minimal stripped-down code that will reproduce this.

    # coding: utf-8
    from dropbox import client, session
    
    APP_KEY = 'aaaaaaaaaaaaaaa'
    APP_SECRET = 'bbbbbbbbbbbbbbb'
    ACCESS_TYPE = 'dropbox'
    ACCESS_KEY = 'cccccccccccccccc'
    ACCESS_SECRET = 'ddddddddddddddd'
    
    sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE)
    sess.set_token(ACCESS_KEY, ACCESS_SECRET)
    client = client.DropboxClient(sess)
    folder_metadata = client.metadata('/')
    

    Any ideas, anyone?

    posted in Pythonista read more
  • MTcoder

    @JonB said:

    Incidentally, @omz, did you update dropbox in the pythonista 2.1 hitting the app store soon? 201009 still has the old version.

    Things have changed with 2.1, and version now exists.

    >>> import dropbox
    >>> print(dropbox.__version__)
    6.4.0
    

    posted in Pythonista read more
  • MTcoder

    @JonB Thank you so much for the stash information. Now your reply makes total sense. Yes, not everyone finds all the little Pythonista nuggets. Just have to keep turning over the rocks. Thanks again.

    posted in Pythonista read more
  • MTcoder

    @JonB Thank you for your attempts to help, and I apologize if I didn't explain things clearly. I am running the latest version of Pythonista, which I think is only for iOS devices. I am using an iPad. I have no idea what version of the Dropbox SDK module I have, as dropbox.__version__does not exist. I have whatever was packaged with Pythonista. From the method calls it is clearly API v1, but beyond that I cannot tell you.

    I think the example code is correct for the version it is packaged with. It is right out of the Pythonista documentation. The newer method for which you gave an example does not exist in this version. Back to my original question, I think the 64-character access key generated by Dropbox is not of any use to me here. But what I captured after my login seems to work.

    stash? pip? Thank you for the suggestion, but I only have an iPad anymore.

    Thanks again, truly. I'll try to keep going on my project with whatever I have in hand.

    posted in Pythonista read more
  • MTcoder

    Dropbox is migrating to SDK API v2. The Dropbox module in Pythonista is for SDK API v1. That probably explains the disconnect between my token and the API I am referencing.

    I was able to get an access key and secret by running the example script and logging in and printing them (access_token.key and access_token.secret). Using these with the set_token() method and removing all the authentication stuff works just fine. These v1 key and secret strings are 16 and 15 in length.

    How do I put in an official request to include Dropbox SDK API v2 in Pythonista? It's a little ugly as both versions need to be around during transition time.

    posted in Pythonista read more
  • MTcoder

    More details.

    The DropboxSession (sess in the code above) object has a set_token() method used as:

    sess.set_token(access_token, access_token_secret)
    

    which says it will attach an access token to the DropboxSession. That sounds perfect, except the Dropbox app page only generates an access token and says nothing about an access secret.

    The generated access token I have is 64 characters long. After the first 32 characters there is an underscore which is then followed by 31 more characters.

    Can my access token be used somehow with the set_token method?

    posted in Pythonista read more
  • MTcoder

    @JonB l am following the method used in the example supplied with the Pythonista onboard documentation. In Console click on the circled ? to Pythonista Documentation > Pythonista Modules > Dropbox which will have the section called Dropbox Client. The session code from the example there looks like this:

    from dropbox import client, rest, session
    APP_KEY = 'my_key_is_here'
    APP_SECRET = 'my_secret_is_here'
    ACCESS_TYPE = 'dropbox'
    sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE)
    request_token = sess.obtain_request_token()
    url = sess.build_authorize_url(request_token)
    # Make the user sign in and authorize this token
    print "url:", url
    print "Please visit this website and press the 'Allow' button, then hit 'Enter' here."
    raw_input()
    # This will fail if the user didn't visit the above URL and hit 'Allow'
    access_token = sess.obtain_access_token(request_token)
    client = client.DropboxClient(sess)
    print "linked account:", client.account_info()
    

    The URL can be used to log in as a user to Dropbox.

    I hope this is what you were asking for.

    Is there a way to rewire this to use the generated access token and avoid the user authentication step? That would make my private scripts log in seamlessly and still use the features of the Dropbox module.

    Thanks again.

    posted in Pythonista read more
  • MTcoder

    I am creating some scripts for my use only that will hopefully be able to use the Dropbox module that is included with Pythonista.

    Since the scripts are private, I would like to use the generated Dropbox access token instead of the app key/secret so that I don't need to go through the login authentication process each time.

    Is there any way to use the access token with the very convenient Dropbox module? The example uses app key/secret and I've not been able to figure out how to use the access token instead. Please help?

    Thank you!

    [By the way, I have been loving Pythonista on my iPad--what a great tool and editor. Thank you again!]

    posted in Pythonista read more
  • MTcoder

    @omz @AtomBombed I am finding the list_ dialog very useful. Thank you for this! I have been successful in using the ListDataSource dictionary to set titles and images. Is there anyway to activate/catch the "accessory_type" items like check mark, etc.? I can make them appear but they are inactive.

    Like Atom I have discovered the slide over "Delete" is present. It clears the dialog list item but I have no idea how to catch this action so I can use it with my data.

    Since delete is there I assume it can be used? I'd highly appreciate knowing how to use these other items. Thank you, anyone.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!