Keeper SDK for Python 3
Project description
Keeper-Security/keeper-sdk-python
Keeper SDK for Python
Installation
pip install keepersdk
Clone source code
$ git clone https://github.com/Keeper-Security/keeper-sdk-python
Example
import os
from login import auth, configuration, endpoint
from vault import sqlite_storage, vault_online, vault_record
config_filename = os.path.join(os.path.dirname(__file__), 'config.json')
config = configuration.JsonConfigurationStorage(file_name=config_filename)
keeper_endpoint = endpoint.KeeperEndpoint(config)
login_auth = auth.LoginAuth(keeper_endpoint)
login_auth.login('username@company.com')
while not login_auth.login_step.is_final():
if isinstance(login_auth.login_step, auth.LoginStepPassword):
password = input('Enter password: ')
login_auth.login_step.verify_password(password)
if isinstance(login_auth.login_step, auth.LoginStepTwoFactor):
channel = login_auth.login_step.get_channels()[0]
code = input(f'Enter 2FA code for {channel.channel_name}: ')
login_auth.login_step.send_code(channel.channel_uid, code)
else:
raise NotImplementedError()
if isinstance(login_auth.login_step, auth.LoginStepConnected):
keeper_auth = login_auth.login_step.keeper_auth()
vault_storage = sqlite_storage.SqliteVaultStorage(file_name=':memory:',
vault_owner=keeper_auth.auth_context.username)
vault = vault_online.VaultOnline(keeper_auth, vault_storage)
vault.sync_down()
# List records
for record in vault.records():
print(f'Title: {record.title}')
if record.version == 2:
legacy_record = vault.load_record(record.record_uid)
if isinstance(legacy_record, vault_record.PasswordRecord):
print(f'Username: {legacy_record.login}')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
keepersdk-0.9.10-py3-none-any.whl
(234.0 kB
view hashes)
Close
Hashes for keepersdk-0.9.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75363f258c3149199e51f94ff19933fd49ea5286f497bc832a978662f1015599 |
|
MD5 | 838bc36953183675754faad8990c26cf |
|
BLAKE2b-256 | 16b9d47be94b98c0a963fc4dc7827bbace0d35634c63d1da4f88f38d748f783a |