Server IP : 127.0.0.2 / Your IP : 18.118.209.158 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/keyring-7.3.egg-info/ |
Upload File : |
Metadata-Version: 1.1 Name: keyring Version: 7.3 Summary: Store and access your passwords safely. Home-page: https://github.com/jaraco/keyring Author: Jason R. Coombs Author-email: jaraco@jaraco.com License: UNKNOWN Description: ======================================= Installing and Using Python Keyring Lib ======================================= .. contents:: **Table of Contents** --------------------------- What is Python keyring lib? --------------------------- The Python keyring lib provides a easy way to access the system keyring service from python. It can be used in any application that needs safe password storage. The keyring library is licensed under both the `MIT license <http://opensource.org/licenses/MIT>`_ and the PSF license. These primary keyring services are supported by the Python keyring lib: * Mac OS X Keychain * Linux Secret Service * Windows Credential Vault Other keyring implementations are provided as well. For more detail, `browse the source <https://github.com/jaraco/keyring/tree/master/keyring/backends>`_. ------------------------- Installation Instructions ------------------------- easy_install or pip =================== Run easy_install or pip:: $ easy_install keyring $ pip install keyring Source installation =================== Download the source tarball from https://pypi.python.org/pypi/keyring, uncompress it, and then run "setup.py install". ------------- Using Keyring ------------- The basic usage of keyring is pretty simple: just call `keyring.set_password` and `keyring.get_password`: >>> import keyring >>> keyring.set_password("system", "username", "password") >>> keyring.get_password("system", "username") 'password' Command-line Utility ==================== Keyring supplies a ``keyring`` command which is installed with the package. After installing keyring in most environments, the command should be available for setting, getting, and deleting passwords. For more information on usage, invoke with no arguments or with ``--help`` as so:: $ keyring --help $ keyring set system username Password for 'username' in 'system': $ keyring get system username password The command-line functionality is also exposed as an executable package, suitable for invoking from Python like so:: $ python -m keyring --help $ python -m keyring set system username Password for 'username' in 'system': $ python -m keyring get system username password -------------------------- Configure your keyring lib -------------------------- The python keyring lib contains implementations for several backends. The library will automatically choose the keyring that is most suitable for your current environment. You can also specify the keyring you like to be used in the config file or by calling the ``set_keyring()`` function. Customize your keyring by config file ===================================== This section describes how to change your option in the config file. Config file path ---------------- The configuration of the lib is stored in a file named "keyringrc.cfg". This file must be found in a platform-specific location. To determine where the config file is stored, run the following:: python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())" Some keyrings also store the keyring data in the file system. To determine where the data files are stored, run this command:: python -c "import keyring.util.platform_; print(keyring.util.platform_.data_root())" Config file content ------------------- To specify a keyring backend, set the **default-keyring** option to the full path of the class for that backend, such as ``keyring.backends.OS_X.Keyring``. If **keyring-path** is indicated, keyring will add that path to the Python module search path before loading the backend. For example, this config might be used to load the SimpleKeyring from the demo directory in the project checkout:: [backend] default-keyring=simplekeyring.SimpleKeyring keyring-path=/home/kang/pyworkspace/python-keyring-lib/demo/ Write your own keyring backend ============================== The interface for the backend is defined by ``keyring.backend.KeyringBackend``. Every backend should derive from that base class and define a ``priority`` attribute and three functions: ``get_password()``, ``set_password()``, and ``delete_password()``. See the ``backend`` module for more detail on the interface of this class. Set the keyring in runtime ========================== Keyring additionally allows programmatic configuration of the backend calling the api ``set_keyring()``. The indicated backend will subsequently be used to store and retrieve passwords. Here's an example demonstrating how to invoke ``set_keyring``:: # define a new keyring class which extends the KeyringBackend import keyring.backend class TestKeyring(keyring.backend.KeyringBackend): """A test keyring which always outputs same password """ priority = 1 def set_password(self, servicename, username, password): pass def get_password(self, servicename, username): return "password from TestKeyring" def delete_password(self, servicename, username, password): pass # set the keyring for keyring lib keyring.set_keyring(TestKeyring()) # invoke the keyring lib try: keyring.set_password("demo-service", "tarek", "passexample") print("password stored sucessfully") except keyring.errors.PasswordSetError: print("failed to store password") print("password", keyring.get_password("demo-service", "tarek")) ----------------------------------------------- Integrate the keyring lib with your application ----------------------------------------------- API interface ============= The keyring lib has a few functions: * ``get_keyring()``: Return the currently-loaded keyring implementation. * ``get_password(service, username)``: Returns the password stored in the active keyring. If the password does not exist, it will return None. * ``set_password(service, username, password)``: Store the password in the keyring. * ``delete_password(service, username)``: Delete the password stored in keyring. If the password does not exist, it will raise an exception. ------------ Get involved ------------ Python keyring lib is an open community project and highly welcomes new contributors. * Repository: https://github.com/jaraco/keyring/ * Bug Tracker: https://github.com/jaraco/keyring/issues/ * Mailing list: http://groups.google.com/group/python-keyring Making Releases =============== Python keyring lib uses a simple tag and release process. The simplified workflow is first tag a release, then invoke ``setup.py release``. Other things to consider when making a release: - first ensure that tests pass (preferably on Windows and Linux) - check that the changelog is current for the intended release - after tagging, but before releasing, push the changes to the repository Running Tests ============= Tests are `continuously run <https://travis-ci.org/#!/jaraco/keyring>`_ using Travis-CI. |BuildStatus|_ .. |BuildStatus| image:: https://secure.travis-ci.org/jaraco/keyring.png .. _BuildStatus: http://travis-ci.org/jaraco/keyring To run the tests yourself, you'll want keyring installed to some environment in which it can be tested. Recommended techniques are described below. Using pytest runner ------------------- Keyring is instrumented with `pytest runner <https://bitbucket.org/jaraco/pytest-runner>`_. Thus, you may invoke the tests from any supported Python (with setuptools installed) using this command:: python setup.py test pytest runner will download any unmet dependencies and run the tests using `pytest <https://bitbucket.org/hpk42/pytest>`_. This technique is the one used by the Travis-CI script. Using virtualenv and pytest/nose/unittest ----------------------------------------- Pytest and Nose are two popular test runners that will discover tests and run them. Unittest also has a mode to discover tests. First, however, these test runners typically need a test environment in which to run. It is recommended that you install keyring to a virtual environment to avoid interfering with your system environment. For more information, see the `venv documentation <https://docs.python.org/dev/library/venv.html>`_ or the `virtualenv homepage <http://www.virtualenv.org>`_. After you've created (or designated) your environment, install keyring into the environment by running:: python setup.py develop You then need to install the test requirements with something like: pip install `python -c "import setup, subprocess; print(subprocess.list2cmdline(setup.test_requirements))"` Then, invoke your favorite test runner, e.g.:: py.test or:: nosetests ---------- Background ---------- The project was based on Tarek Ziade's idea in `this post`_. Kang Zhang initially carried it out as a `Google Summer of Code`_ project, and Tarek mentored Kang on this project. .. _this post: http://tarekziade.wordpress.com/2009/03/27/pycon-hallway-session-1-a-keyring-library-for-python/ .. _Google Summer of Code: http://socghop.appspot.com/ Keywords: keyring Keychain GnomeKeyring Kwallet password storage Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5