### Keyring Configuration File Example Source: https://keyring.readthedocs.io/en/latest?badge=latest An example configuration file content for keyring, specifying a default keyring backend and an additional path to search for modules. This is used to customize keyring's behavior. ```ini [backend] default-keyring=simplekeyring.SimpleKeyring keyring-path=demo ``` -------------------------------- ### Install and Use Keyring on Ubuntu 16.04 Source: https://keyring.readthedocs.io/en/latest?badge=latest This snippet demonstrates the complete process of installing and using the Keyring library in a virtual environment on Ubuntu 16.04, including setting and retrieving a password. ```bash $ sudo apt install python3-venv libdbus-glib-1-dev $ cd /tmp $ pyvenv py3 $ source py3/bin/activate $ pip install -U pip $ pip install secretstorage dbus-python $ pip install keyring $ python >>> import keyring >>> keyring.get_keyring() >>> keyring.set_password("system", "username", "password") >>> keyring.get_password("system", "username") 'password' ``` -------------------------------- ### Install Keyring with Completion Extra Source: https://keyring.readthedocs.io/en/latest?badge=latest Installs the keyring library with the 'completion' extra, which is required for shell tab completion functionality. ```bash $ pip install 'keyring[completion]' ``` -------------------------------- ### Set and Get Password using Keyring API Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates the basic usage of the keyring library to set and retrieve a password for a given system and username. Ensure the keyring library is installed. ```python import keyring keyring.set_password("system", "username", "password") keyring.get_password("system", "username") ``` -------------------------------- ### Display Keyring Command-Line Help Source: https://keyring.readthedocs.io/en/latest?badge=latest Shows how to display the help message for the keyring command-line utility. This command is installed with the keyring package. ```bash $ keyring --help ``` -------------------------------- ### Install and Use Keyring in a Docker Container Source: https://keyring.readthedocs.io/en/latest?badge=latest This snippet shows the steps to install and use the Keyring library with the SecretService backend within a Docker container on Ubuntu 18.04, including unlocking the system's keyring. ```bash docker run -it -d --privileged ubuntu:18.04 $ apt-get update $ apt install -y gnome-keyring python3-venv python3-dev $ python3 -m venv venv $ source venv/bin/activate # source a virtual environment to avoid polluting your system $ pip3 install --upgrade pip $ pip3 install keyring $ dbus-run-session -- sh # this will drop you into a new D-bus shell $ echo 'somecredstorepass' | gnome-keyring-daemon --unlock # unlock the system's keyring $ python >>> import keyring >>> keyring.get_keyring() >>> keyring.set_password("system", "username", "password") >>> keyring.get_password("system", "username") 'password' ``` -------------------------------- ### SchemeSelectable Backend Query Examples Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates how the SchemeSelectable backend queries credentials with different schemes and parameters. It shows the flexibility in handling service and username configurations. ```python >>> backend = SchemeSelectable() >>> backend._query('contoso', 'alice') {'username': 'alice', 'service': 'contoso'} >>> backend._query('contoso') {'service': 'contoso'} >>> backend.scheme = 'KeePassXC' >>> backend._query('contoso', 'alice') {'UserName': 'alice', 'Title': 'contoso'} >>> backend._query('contoso', 'alice', foo='bar') {'UserName': 'alice', 'Title': 'contoso', 'foo': 'bar'} ``` -------------------------------- ### Keyring Backend - Get Viable Backends Source: https://keyring.readthedocs.io/en/latest/index.html Class method to return an iterator over all subclasses of KeyringBackend that are considered viable for use. ```python classmethod get_viable_backends() -> filter[type[KeyringBackend]] ``` -------------------------------- ### Get Current Keyring Backend Source: https://keyring.readthedocs.io/en/latest/index.html Retrieves the currently active keyring backend implementation. ```python keyring.get_keyring() -> KeyringBackend ``` -------------------------------- ### Class Property Example Source: https://keyring.readthedocs.io/en/latest/index.html Illustrates the usage of a class property, which behaves like a property but operates at the class level. It supports getters and setters. ```python import classproperty class X: val = None @classproperty def foo(cls): return cls.val @foo.setter def foo(cls, val): cls.val = val # Example usage: # X.foo = 3 # X.foo # 3 # x = X() # x.foo # 3 # X.foo = 4 # x.foo # 4 ``` -------------------------------- ### Classproperty usage with setter Source: https://keyring.readthedocs.io/en/latest?badge=latest Illustrates the usage of the classproperty decorator to create properties that behave like class attributes. This example shows how to define a getter and a setter for a classproperty, and how setting it on an instance affects the class. ```python >>> class X(metaclass=classproperty.Meta): ... val = None ... @classproperty ... def foo(cls): ... return cls.val ... @foo.setter ... def foo(cls, val): ... cls.val = val >>> X.foo >>> X.foo = 3 >>> X.foo 3 >>> x = X() >>> x.foo 3 >>> X.foo = 4 >>> x.foo 4 ``` ```python >>> x.foo = 5 >>> x.foo 5 >>> X.foo 5 >>> vars(x) {} >>> X().foo 5 ``` -------------------------------- ### Generate Bash Shell Completions Source: https://keyring.readthedocs.io/en/latest?badge=latest Generates bash shell completion scripts for the keyring command and prints them to standard output. This output can be redirected to a file for installation. ```bash $ keyring --print-completion bash | sudo tee /usr/share/bash-completion/completions/keyring ``` -------------------------------- ### Get Password using Keyring Command-Line Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a previously set password for a username in a specific system using the keyring command-line utility. ```bash $ keyring get system username password ``` -------------------------------- ### Keyring Backend Interface - Get Password Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method definition for retrieving a password from a keyring backend. Implementations must provide this functionality. ```python abstractmethod get_password(_service : str_, _username : str_) -> str | None ``` -------------------------------- ### Generate Zsh Shell Completions Source: https://keyring.readthedocs.io/en/latest?badge=latest Generates zsh shell completion scripts for the keyring command and prints them to standard output. This output can be redirected to a file for installation. ```bash $ keyring --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_keyring ``` -------------------------------- ### Get Password Source: https://keyring.readthedocs.io/en/latest/index.html Retrieves the password for a given username and service name. Returns None if the password is not found. ```python keyring.get_password(_service_name : str_, _username : str_) -> str | None ``` -------------------------------- ### Legacy classproperty usage without metaclass Source: https://keyring.readthedocs.io/en/latest?badge=latest Illustrates the legacy behavior of classproperty when the metaclass is not explicitly specified. This example highlights the difference in behavior, particularly when setting properties on instances. ```python >>> class X: ... val = None ... @classproperty ... def foo(cls): ... return cls.val ... @foo.setter ... def foo(cls, val): ... cls.val = val >>> X.foo >>> X.foo = 3 >>> X.foo 3 >>> x = X() >>> x.foo 3 >>> X.foo = 4 >>> x.foo 4 ``` ```python >>> x.foo = 5 >>> x.foo 5 >>> X.foo # should be 5 4 >>> vars(x) # should be empty {'foo': 5} >>> X().foo # should be 5 4 ``` -------------------------------- ### Get Credential Source: https://keyring.readthedocs.io/en/latest/index.html Retrieves a Credential object (containing username and password) for the specified service. The username can be optional. ```python keyring.get_credential(_service_name : str_, _username : str | None_) -> Credential | None ``` -------------------------------- ### Get Password using Keyring Module Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a previously set password for a username in a specific system by invoking the keyring module directly from Python. ```bash $ python -m keyring get system username password ``` -------------------------------- ### Keyring Backend Interface - Get Credential Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method definition for retrieving a Credential object for a given service and optional username. Callers must use the returned username. ```python get_credential(_service : str_, _username : str | None_) -> Credential | None ``` -------------------------------- ### Generate Tcsh Shell Completions Source: https://keyring.readthedocs.io/en/latest?badge=latest Generates tcsh shell completion scripts for the keyring command and prints them to standard output. This output can be redirected to a file for installation. ```bash $ keyring --print-completion tcsh | sudo tee /etc/profile.d/keyring.csh ``` -------------------------------- ### Example of using ExceptionTrap decorator Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates how to use the ExceptionTrap decorator to catch specific exceptions and return a boolean indicating success or failure. This is useful for functions that are expected to fail under certain conditions. ```python >>> @ExceptionTrap(ValueError).passes ... def fail(): ... raise ValueError('failed') ``` ```python >>> fail() False ``` -------------------------------- ### Initialize Backend with Recommended Keyrings Source: https://keyring.readthedocs.io/en/latest/history.html Limits backend initialization to only recommended keyrings with a priority of 1 or greater. Use this to ensure only preferred backends are loaded. ```python keyring.core.init_backend(limit=keyring.core.recommended) ``` -------------------------------- ### Define and Use a Custom Keyring Backend Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates how to define a custom keyring backend by extending `keyring.backend.KeyringBackend` and then setting it as the active keyring for the library. ```python import keyring.backend class TestKeyring(keyring.backend.KeyringBackend): """A test keyring which always outputs the 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): 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 successfully") except keyring.errors.PasswordSetError: print("failed to store password") print("password", keyring.get_password("demo-service", "tarek")) ``` -------------------------------- ### Invoke Keyring from Command Line Source: https://keyring.readthedocs.io/en/latest/history.html Demonstrates how to invoke the Keyring library directly from the command line using the python -m keyring command. ```python python -m keyring ``` -------------------------------- ### Set Password using Keyring Command-Line Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates setting a password for a username in a specific system using the keyring command-line utility. You will be prompted to enter the password. ```bash $ keyring set system username Password for 'username' in 'system': ``` -------------------------------- ### keyring.core.init_backend Source: https://keyring.readthedocs.io/en/latest?badge=latest Loads a detected keyring backend, optionally filtered by a provided callable. ```APIDOC ## keyring.core.init_backend ### Description Load a detected backend. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_limit** (Callable[[KeyringBackend], bool] | None) - Optional - A callable to filter detected backends. ``` -------------------------------- ### Display Keyring Module Help Source: https://keyring.readthedocs.io/en/latest?badge=latest Shows how to display the help message for the keyring module when invoked as an executable package from Python. ```bash $ python -m keyring --help ``` -------------------------------- ### keyring.core.recommended Source: https://keyring.readthedocs.io/en/latest?badge=latest Checks if a given backend is recommended. ```APIDOC ## keyring.core.recommended ### Description Checks if a backend is recommended. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_backend_** (KeyringBackend) - Required - The backend to check. ``` -------------------------------- ### Basic Password Management Source: https://keyring.readthedocs.io/en/latest/index.html Demonstrates the fundamental usage of keyring for setting and retrieving passwords programmatically. Ensure the 'keyring' library is imported. ```python >>> import keyring >>> keyring.set_password("system", "username", "password") >>> keyring.get_password("system", "username") 'password' ``` -------------------------------- ### Set Password using Keyring Module Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates setting a password for a username in a specific system by invoking the keyring module directly from Python. You will be prompted to enter the password. ```bash $ python -m keyring set system username Password for 'username' in 'system': ``` -------------------------------- ### Set OS X Keyring Store to 'internet' Source: https://keyring.readthedocs.io/en/latest/history.html Demonstrates how to change the default store for the OS X Keyring backend to 'internet' and then set and retrieve a password. ```python keys = keyring.backends.OS_X.Keyring() keys.store = 'internet' keys.set_password(system, user, password) keys.get_password(system, user) ``` -------------------------------- ### Keyring Backend - Set Properties from Environment Source: https://keyring.readthedocs.io/en/latest/index.html Sets keyring properties based on environment variables prefixed with KEYRING_PROPERTY_. ```python set_properties_from_env() -> None ``` -------------------------------- ### keyring.core.load_env Source: https://keyring.readthedocs.io/en/latest?badge=latest Loads a keyring configuration from environment variables. ```APIDOC ## keyring.core.load_env ### Description Load a keyring configured in the environment variable. ### Method Not specified (assumed to be a function call). ### Parameters None. ### Response #### Success Response - **KeyringBackend | None** - The loaded keyring backend, or None if not configured via environment variables. ``` -------------------------------- ### keyring.core.load_config Source: https://keyring.readthedocs.io/en/latest?badge=latest Loads a keyring configuration from the system's configuration file. ```APIDOC ## keyring.core.load_config ### Description Load a keyring using the config file in the config root. ### Method Not specified (assumed to be a function call). ### Parameters None. ### Response #### Success Response - **KeyringBackend | None** - The loaded keyring backend, or None if no configuration is found. ``` -------------------------------- ### Select Keyring Backend via Environment Variable Source: https://keyring.readthedocs.io/en/latest/history.html Allows selection of a specific keyring backend using the PYTHON_KEYRING_BACKEND environment variable. Useful for disabling keyring by setting it to keyring.backends.null.Keyring. ```bash export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring ``` -------------------------------- ### keyring.backend.KeyringBackend.get_viable_backends Source: https://keyring.readthedocs.io/en/latest/index.html Class method to return all subclasses deemed viable as keyring backends. ```APIDOC ## get_viable_backends() -> filter[type[KeyringBackend]] ### Description Return all subclasses deemed viable. ### Parameters None ### Method N/A (Class Method) ### Endpoint N/A (Class Method) ``` -------------------------------- ### Keyring Backend - With Properties Source: https://keyring.readthedocs.io/en/latest/index.html A method or decorator that allows setting specific properties for a keyring backend instance. ```python with_properties(_** kwargs: Any_) -> KeyringBackend ``` -------------------------------- ### Set Default OS X Keyring Store Source: https://keyring.readthedocs.io/en/latest/history.html Shows how to set the default store for all instances of the OS X Keyring backend to 'internet'. ```python keyring.backends.OS_X.Keyring.store = 'internet' ``` -------------------------------- ### keyring.get_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves the currently configured keyring backend. ```APIDOC ## keyring.get_keyring ### Description Gets the current keyring backend instance. ### Method `keyring.get_keyring() → KeyringBackend` ### Returns `KeyringBackend` - The current keyring backend. ``` -------------------------------- ### Disabling Keyring and Handling Errors Source: https://keyring.readthedocs.io/en/latest?badge=latest Shows how to disable the current keyring and demonstrates the expected RuntimeError when attempting to disable it again. ```python >>> fs = getfixture('fs') >>> disable() >>> disable() Traceback (most recent call last): ... RuntimeError: Refusing to overwrite... ``` -------------------------------- ### EnvironCredential Equality Comparison Source: https://keyring.readthedocs.io/en/latest?badge=latest Illustrates the equality comparison for EnvironCredential objects. Two credentials are equal if their environment variable names for user and password match. ```python >>> e1 = EnvironCredential('a', 'b') >>> e2 = EnvironCredential('a', 'b') >>> e3 = EnvironCredential('a', 'c') >>> e1 == e2 True >>> e2 == e3 False ``` -------------------------------- ### keyring.backend.get_all_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Returns a list of all implemented keyrings that can be constructed without parameters. ```APIDOC ## keyring.backend.get_all_keyring ### Description Return a list of all implemented keyrings that can be constructed without parameters. ### Method Not specified (assumed to be a function call). ### Parameters None. ### Response #### Success Response - **list[KeyringBackend]** - A list of constructible KeyringBackend instances. ``` -------------------------------- ### Set Keyring Backend Source: https://keyring.readthedocs.io/en/latest/index.html Sets a specific keyring backend implementation to be used. ```python keyring.set_keyring(_keyring : KeyringBackend_) -> None ``` -------------------------------- ### keyring.core.load_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Loads a specific keyring by its fully-qualified name. ```APIDOC ## keyring.core.load_keyring ### Description Load the specified keyring by name (a fully-qualified name to the keyring, such as ‘keyring.backends.file.PlaintextKeyring’) ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_keyring_name** (str) - Required - The fully-qualified name of the keyring to load. ``` -------------------------------- ### keyring.core.get_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves the currently active keyring backend. ```APIDOC ## keyring.core.get_keyring ### Description Get current keyring backend. ### Method Not specified (assumed to be a function call). ### Parameters None. ### Response #### Success Response - **KeyringBackend** - The current keyring backend instance. ``` -------------------------------- ### Classproperty with classmethod and staticmethod Source: https://keyring.readthedocs.io/en/latest?badge=latest Shows how to combine classproperty with classmethod and staticmethod. This allows for properties that can be accessed and called at the class level, providing flexibility in defining class-level behaviors. ```python >>> class Static(metaclass=classproperty.Meta): ... @classproperty ... @classmethod ... def foo(cls): ... return 'foo' ... @classproperty ... @staticmethod ... def bar(): ... return 'bar' >>> Static.foo 'foo' >>> Static.bar 'bar' ``` -------------------------------- ### Keyring Backend Interface - Set Password Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method definition for setting a password for a user and service within a keyring backend. Implementations must handle password storage. ```python abstractmethod set_password(_service : str_, _username : str_, _password : str_) -> None ``` -------------------------------- ### keyring.set_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets the current keyring backend. ```APIDOC ## keyring.set_keyring ### Description Sets the current keyring backend to the provided instance. ### Method `keyring.set_keyring(_keyring : KeyringBackend_)` ### Parameters * **_keyring** (KeyringBackend) - The KeyringBackend instance to set as the current backend. ### Returns None ``` -------------------------------- ### keyring.set_properties_from_env Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets keyring properties from environment variables. ```APIDOC ## keyring.set_properties_from_env ### Description For all KEYRING_PROPERTY_* env var, set that property. ### Method `set_properties_from_env() → None` ### Returns None ``` -------------------------------- ### Use get_password with getpass.getuser() Source: https://keyring.readthedocs.io/en/latest/history.html Replaces the deprecated getpassbackend module. Use this pattern to retrieve a password using the current user and a specified service name. ```python import getpass import keyring keyring.get_password(getpass.getuser(), 'Python') ``` -------------------------------- ### keyring.core.get_credential Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a Credential object for a given service and optional username. ```APIDOC ## keyring.core.get_credential ### Description Get a Credential for the specified service. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_service_name** (str) - Required - The name of the service. - **_username** (str | None) - Optional - The username associated with the credential. ### Response #### Success Response - **Credential | None** - The Credential object if found, otherwise None. ``` -------------------------------- ### keyring.core.disable Source: https://keyring.readthedocs.io/en/latest?badge=latest Configures the null keyring as the default, effectively disabling password storage. ```APIDOC ## keyring.core.disable ### Description Configure the null keyring as the default. ### Method Not specified (assumed to be a function call). ### Parameters None. ### Response #### Success Response None (operation is void). ### Error Handling - `RuntimeError`: Raised if attempting to overwrite an existing configuration. ``` -------------------------------- ### keyring.backend.KeyringBackend.get_credential Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a Credential object for a given username and service from a backend. ```APIDOC ## keyring.backend.KeyringBackend.get_credential ### Description Gets the username and password for the service. Returns a Credential instance. The _username_ argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username. ### Method `get_credential(_service : str_, _username : str | None_) → Credential | None` ### Parameters * **_service** (str) - The name of the service. * **_username** (str | None) - The username for which to retrieve the credential. This argument is optional. ### Returns `Credential | None` - A Credential object if found, otherwise None. ``` -------------------------------- ### Set Custom Keychain for OS X Backend Source: https://keyring.readthedocs.io/en/latest/history.html Allows specifying a custom keychain file for the OS X backend when retrieving passwords. This is useful in environments like cron where the default keychain may differ. ```python keyring.get_keyring().keychain = '/path/to/login.keychain' pw = keyring.get_password(...) ``` -------------------------------- ### Override SecretService/libsecret scheme with properties Source: https://keyring.readthedocs.io/en/latest/history.html Use the `.with_properties` method to create a new keyring instance with overridden properties, such as the scheme for SecretService/libsecret backends. This is useful for compatibility with different schemes like KeePassXC. ```python keypass = keyring.get_keyring().with_properties(scheme='KeePassXC') ``` -------------------------------- ### keyring.get_credential Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a Credential object for a given username and service name. ```APIDOC ## keyring.get_credential ### Description Gets a Credential for the specified service. The username argument is optional. ### Method `keyring.get_credential(_service_name : str_, _username : str | None_)` ### Parameters * **_service_name** (str) - The name of the service. * **_username** (str | None) - The username for which to retrieve the credential. This argument is optional. ### Returns `Credential | None` - A Credential object if found, otherwise None. ``` -------------------------------- ### Keyring Backend Meta Class Source: https://keyring.readthedocs.io/en/latest/index.html The metaclass for KeyringBackend, responsible for specialized subclass behavior and maintaining a registry of non-abstract types. ```python class keyring.backend.KeyringBackendMeta(_name_ , _bases_ , _namespace_ , _/_ , _** kwargs_) ``` -------------------------------- ### NullCrypter Implementation Source: https://keyring.readthedocs.io/en/latest/index.html A concrete implementation of the Crypter base class that likely performs no actual encryption or decryption. ```python class keyring.backend.NullCrypter ``` -------------------------------- ### keyring.core.set_keyring Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets a specific keyring backend as the current default. ```APIDOC ## keyring.core.set_keyring ### Description Set current keyring backend. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_keyring** (KeyringBackend) - Required - The keyring backend to set as current. ``` -------------------------------- ### keyring.backend.KeyringBackend.set_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets the password for a given username and service in a backend. ```APIDOC ## keyring.backend.KeyringBackend.set_password ### Description Set password for the username of the service. If the backend cannot store passwords, raise PasswordSetError. ### Method `set_password(_service : str_, _username : str_, _password : str_) → None` ### Parameters * **_service** (str) - The name of the service. * **_username** (str) - The username for which to set the password. * **_password** (str) - The password to set. ### Returns None ### Raises `PasswordSetError` - If the backend cannot store passwords. ``` -------------------------------- ### keyring.backend.KeyringBackend.get_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves the password for a given username and service from a backend. ```APIDOC ## keyring.backend.KeyringBackend.get_password ### Description Get password of the username for the service. ### Method `get_password(_service : str_, _username : str_) → str | None` ### Parameters * **_service** (str) - The name of the service. * **_username** (str) - The username for which to retrieve the password. ### Returns `str | None` - The password string if found, otherwise None. ``` -------------------------------- ### keyring.backend.Crypter.encrypt Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method to encrypt a given value. ```APIDOC ## encrypt(_value_) ### Description Encrypt the value. ### Parameters #### Path Parameters - **_value_** - Required - The value to encrypt. ### Method N/A (Abstract Method) ### Endpoint N/A (Abstract Method) ``` -------------------------------- ### keyring.set_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets the password for a given username and service name. ```APIDOC ## keyring.set_password ### Description Sets the password for the user in the specified service. ### Method `keyring.set_password(_service_name : str_, _username : str_, _password : str_)` ### Parameters * **_service_name** (str) - The name of the service. * **_username** (str) - The username for which to set the password. * **_password** (str) - The password to set. ### Returns None ``` -------------------------------- ### keyring.get_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves the password for a given username and service name. ```APIDOC ## keyring.get_password ### Description Gets the password from the specified service for the given username. ### Method `keyring.get_password(_service_name : str_, _username : str_)` ### Parameters * **_service_name** (str) - The name of the service. * **_username** (str) - The username for which to retrieve the password. ### Returns `str | None` - The password string if found, otherwise None. ``` -------------------------------- ### Class Property with ClassMethod/StaticMethod Source: https://keyring.readthedocs.io/en/latest/index.html Shows how a class property can wrap class methods or static methods, allowing them to be accessed and potentially modified at the class level. ```python import classproperty class Static: @classproperty @classmethod def foo(cls): return 'foo' @classproperty @staticmethod def bar(): return 'bar' # Example usage: # Static.foo # 'foo' # Static.bar # 'bar' ``` -------------------------------- ### keyring.core.get_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Retrieves a stored password for a given service and username. ```APIDOC ## keyring.core.get_password ### Description Get password from the specified service. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_service_name** (str) - Required - The name of the service. - **_username** (str) - Required - The username associated with the password. ### Response #### Success Response - **str | None** - The password string if found, otherwise None. ``` -------------------------------- ### keyring.core.set_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Sets or updates a password for a given service and username. ```APIDOC ## keyring.core.set_password ### Description Set password for the user in the specified service. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_service_name** (str) - Required - The name of the service. - **_username** (str) - Required - The username associated with the password. - **_password** (str) - Required - The password to set. ### Response #### Success Response None (operation is void). ``` -------------------------------- ### Set Password Source: https://keyring.readthedocs.io/en/latest/index.html Sets a password for a given username and service name. This function is part of the main keyring API. ```python keyring.set_password(_service_name : str_, _username : str_, _password : str_) -> None ``` -------------------------------- ### Classproperty with a getter only Source: https://keyring.readthedocs.io/en/latest?badge=latest Demonstrates a classproperty that only has a getter defined. Attempting to set an attribute on this classproperty will result in an AttributeError, as expected for read-only properties. ```python >>> class GetOnly(metaclass=classproperty.Meta): ... @classproperty ... def foo(cls): ... return 'bar' >>> GetOnly.foo = 3 Traceback (most recent call last): ... AttributeError: can't set attribute ``` -------------------------------- ### Keyring Backend Interface - Delete Password Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method definition for deleting a password associated with a user and service from a keyring backend. Implementations should raise PasswordDeleteError if deletion is not supported. ```python delete_password(_service : str_, _username : str_) -> None ``` -------------------------------- ### keyring.backend.Crypter.decrypt Source: https://keyring.readthedocs.io/en/latest/index.html Abstract method to decrypt a given value. ```APIDOC ## decrypt(_value_) ### Description Decrypt the value. ### Parameters #### Path Parameters - **_value_** - Required - The value to decrypt. ### Method N/A (Abstract Method) ### Endpoint N/A (Abstract Method) ``` -------------------------------- ### keyring.backend.KeyringBackend.delete_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Deletes the password for a given username and service from a backend. ```APIDOC ## keyring.backend.KeyringBackend.delete_password ### Description Deletes the password for the username of the service. If the backend cannot delete passwords, raise PasswordDeleteError. ### Method `delete_password(_service : str_, _username : str_) → None` ### Parameters * **_service** (str) - The name of the service. * **_username** (str) - The username for which to delete the password. ### Returns None ### Raises `PasswordDeleteError` - If the backend cannot delete passwords. ``` -------------------------------- ### keyring.delete_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Deletes the password for a given username and service name. ```APIDOC ## keyring.delete_password ### Description Deletes the password for the user in the specified service. ### Method `keyring.delete_password(_service_name : str_, _username : str_)` ### Parameters * **_service_name** (str) - The name of the service. * **_username** (str) - The username for which to delete the password. ### Returns None ``` -------------------------------- ### Delete Password Source: https://keyring.readthedocs.io/en/latest/index.html Deletes the password for a given username and service name. This operation is irreversible. ```python keyring.delete_password(_service_name : str_, _username : str_) -> None ``` -------------------------------- ### keyring.core.delete_password Source: https://keyring.readthedocs.io/en/latest?badge=latest Deletes a stored password for a given service and username. ```APIDOC ## keyring.core.delete_password ### Description Delete the password for the user in the specified service. ### Method Not specified (assumed to be a function call). ### Parameters #### Path Parameters - **_service_name** (str) - Required - The name of the service. - **_username** (str) - Required - The username associated with the password. ### Response #### Success Response None (operation is void). ### Error Handling - `RuntimeError`: May occur if the keyring is not properly configured or accessible. ``` -------------------------------- ### Crypter Base Class Source: https://keyring.readthedocs.io/en/latest/index.html Base class for encryption and decryption operations. Implementations must provide abstract methods for encrypt and decrypt. ```python class keyring.backend.Crypter ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.