Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script #1190

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Script #1190

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions examples/one_time_share.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import argparse
import logging
import sys

from keepercommander import api
from keepercommander.__main__ import get_params_from_config
from keepercommander.commands import register

parser = argparse.ArgumentParser(description='Create one time share URL')
parser.add_argument('--name', dest='share_name', action='store', help='one-time share URL name')
parser.add_argument('-e', '--expire', dest='expire', action='store', metavar='<NUMBER>[(m)inutes|(h)ours|(d)ays]',
help='Time period record share URL is valid.')
parser.add_argument('record', nargs='?', type=str, action='store', help='record path or UID')

opts, flags = parser.parse_known_args(sys.argv[1:])

# Load Keeper configuration file
my_params = get_params_from_config('')

# Login to Keeper
api.login(my_params)
if not my_params.session_token:
exit(1)

# Load vault
api.sync_down(my_params)

# Create one time share command
cmd = register.OneTimeShareCreateCommand()
url = cmd.execute(my_params, record=opts.record, share_name=opts.share_name, expire=opts.expire)
print(url)
Loading