JSONDecodeError Raised from OnePassword.get_item()
Describe the bug When you call the get_item() function with a valid item Id and list containing invalid invalid field names: op = OnePassword() op.get_item(id="valid_id_1234", ["invalid_field1","invalid_field2"])
You get the error Message: [ERROR] 2025/03/20 15:14:32 "invalid_field1" isn't a field in the "BAD" item
And then you get:
JSONDecodeError Traceback (most recent call last) ... ssword/client.py:437, in OnePassword.get_item(uuid, fields, vault) 435 vault_flag = f"--vault {vault}" if vault else "" 436 if isinstance(fields, list): --> 437 item_list = json.loads(read_bash_return( 438 "op item get {} --format=json --fields label={} {}".format(uuid, ",label=".join(fields), vault_flag), 439 single=False)) 440 item = {} 441 if isinstance(item_list, dict): ...
To Reproduce Steps to reproduce the behavior: replace the entry id below with a valid id from op.list_items(): op = OnePassword() op.get_item(id="valid_id_1234", ["invalid_field1","invalid_field2"])
Expected behavior return the error without raising a JSONDecodeException
Desktop (please complete the following information):
- OS: Ubuntu 20.04.6
- Firefox pip 1password == 1.1.3 op cli version 2.30.3
Thanks for the issue submission! Will have a look when we have time, hopefully in coming week! Feel free to submit a PR also if you think you can fix it :D