Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
zcutlip
4 years agoDedicated Contributor
Update to `pyonepassword` to optionally re-use existing sessions.
Just wanted to share that I updated pyonepassword
to optionally re-use existing op
sessions. This should make things a bit nicer for scripting.
For example, if you did eval $(op signin)
on the command line, you could then instantiate your OP
object without need for credentials:
python
op = OP(use_existing_session=True)
A couple of related changes are:
- If you try to use an existing session, and you pass password_prompt=False
, and there's no existing session you'll get a OPNotSignedInException
- This allows you to fall back to a password prompt if desired
- If no valid session is available and you pass password_prompt=True
(the default), you'll get op
's native prompt on the console
You can get v1.9.2 from PyPI.
Thanks to @mconigliaro for the GitHub issue.
Zach
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
1 Reply
- Former Member
Hi zcutlip,
Thanks for sharing! This is very clever.