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.


    KeychainDB: Persistent Database in the Keychain

    Pythonista
    2
    2
    2116
    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.
    • parm
      parm last edited by

      Hey all,

      Thought I'd share a quick script I wrote called KeychainDB. It's a wrapper for the keychain which allows you to use the keychain as a persistent (i.e. maintains state across app launches) database.

      Each entry in the keychain has three elements: service, username, and password. KeychainDB behaves like a Dictionary, using the username field to store keys and the password field to store values. Service is set to DB_NAME, 'KeychainDB' by default, for all entries to separate KeychainDB entries from legitimate password storage.

      Since a KeychainDB behaves like a dict, it's very easy to use and requires no knowledge of database systems. Example usage:

      from keychaindb import KeychainDB
      kdb = KeychainDB()
      kdb['test'] = 'example'
      kdb['test'] #=> 'example'
      

      If you kill and reopen Pythonista and execute kdb['test'], KeychainDB will return 'example'.

      Hope this is helpful and you guys can use it in interesting ways. The script is located here: https://gist.github.com/mattparmett/7948268

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

        Very good!

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