Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
Former Member
5 years ago[32] Set value from other variable / assignment
The simple use case is to copy one value somewhere else.
Let's say I have an Item as follow
MyItem
- oldSection
- a_var=value
For the basic "copy.paste" use case, I would ...
1P_Simon
1Password Team
4 years agoI was just looking for smoothing the process, and get this "updating" code out of python, back into 1password templates
When we're dreaming for a little (more long-term, I don't want to suggest that we can get to this right away), how would an ideal solution look like for you? Would you like to continue using the CLI directly from your Python code or would you prefer if 1Password would take care of that by supporting a Python SDK that allows you to perform actions like copying items?
For example, I could imagine https://github.com/1Password/connect-sdk-python supporting both Connect as well as personal accounts via Biometric Unlock (optionally via CLI) as a backing service.
The main benefit being that you can clean up your code further by replacing your os.system calls with direct calls to the 1Password SDK.
Would love to hear your thoughts and dreams!
That said, a more short-term solution: could you start a shell in your call to os.system so it does support evaluation?
My Python is a little rusty, so excuse any errors. I imagine something like this:
os.system("sh -c op item edit MyItem "newSection.my_var[Text]=$(op item get MyItem --field a_var)")