I have a python script where I would like to be prompted to log into one password and then have the rest of the script retrieve various login information that I have stored.
The script looks something like this:
`import os os.system("eval $(op signin my_account)") os.system("op get totp [item]") more op get instructions`
--> results in a not logged in error
I have also tried:
`session_token = subprocess.check_output("op signin [my_account] --raw", shell=True, text=True) two_factor = os.system("op get totp [my item] --session session_token") print(two_factor)`
--> results in an invalid session key error
I know I am having a session error. The os.system command creates its own terminal session which is then closed after the command, which also logs me back out of onepassword.
Can you please give me any suggestions for how to log into one password within the runtime of my python script?
(I am on macOS Mojave, Python 3.8, op 0.9.3)
1Password Version: op 0.9.3
Extension Version: N/A
OS Version: OSX 10.14.6
Sync Type: N/A