Module macrobond_data_api.util.save_credentials_to_keyring
Functions
def save_credentials_to_keyring(warn_before_removing: bool = True, ask_for_service_name: bool = False) ‑> bool
-
Create or update the credentials for the API in the system's keyring interactively via the terminal.
By defult the method will ask interactively for: * username, is the user's Macrobond Web Api username. * password, is the user's Macrobond Web Api password.
If ask_for_service_name is
True
, then it will also ask for a service name. The service name becomes the name of the key in the user's keyring.Parameters
warn_before_removing
:bool
- Optional bool whether the method should ask before removing keys, default to
True
. ask_for_service_name
:bool
- Optional bool whether the method should ask for a service name to use, default to
False
.
Returns
bool
returnsTrue
if the key was successful created or update in the keyring.Remarks
Note
It is easy to run this method via the terminal.
python -c "from macrobond_data_api.util import *; save_credentials_to_keyring()"
Caution
This method can remove keys in your keyring, but it will ask first by default about warn_before_removing is
True
.Supported Keyrings
- macOS Keychain
- Freedesktop Secret Service supports many DE including GNOME (requires secretstorage)
- KDE4 & KDE5 KWallet (requires dbus)
- Windows Credential Locker