diff --git a/onepassword.py b/onepassword.py index 52c889c..a89926b 100644 --- a/onepassword.py +++ b/onepassword.py @@ -1,3 +1,4 @@ +import base64 import json import os import re @@ -129,6 +130,8 @@ def get(self, resource, item_name): def get_access_token(self, secret, shorthand): try: + if not os.environ.get("OP_DEVICE"): + os.environ["OP_DEVICE"] = base64.b32encode(os.urandom(16)).decode().lower().rstrip("=") process = subprocess.run( (f"echo '{secret['password']}' | " f"{self.op} signin {secret['signin_address']} {secret['username']} {secret['secret_key']} " diff --git a/pyproject.toml b/pyproject.toml index 335d4f3..f6544b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "onepassword" -version = "0.4.0" +version = "0.4.1" description = "Python wrapper for the 1password CLI" repository = "https://github.com/lettdigital/onepassword-python"