corpusops/bitwardentools

add edit_item/edit_login functionality

perkons opened this issue · 1 comments

Would be nice to have an option to edit/update existing items. Here https://pypi.org/project/bitwardentools/ it does not say if edit itmes/logins is possible, but I can see in the pyton code edit_login = edit_item. Is this supported already?

I am able to add items, logins, collections and get ciphers, but not edit or update.
I have tried to update the password of a login with JSON payload like this:

>>> payload = {
...     "login": {
...         "username": "root", "password": "password2"
...     }
... }
>>> client.edit_login("server1", orga="organization1", collections=["collection1"], **payload)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.10/site-packages/bitwardentools/client.py", line 1297, in edit_item
    return self.create_item(*a, **kw)
  File "/home/user/.local/lib/python3.10/site-packages/bitwardentools/client.py", line 1265, in create_item
    u = f'/api/ciphers/{data["id"]}'
KeyError: 'id'
>>> client.edit_login(name="server1", orga="organization1", collection="collection1", **payload)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.10/site-packages/bitwardentools/client.py", line 1297, in edit_item
    return self.create_item(*a, **kw)
  File "/home/user/.local/lib/python3.10/site-packages/bitwardentools/client.py", line 1265, in create_item
    u = f'/api/ciphers/{data["id"]}'
KeyError: 'id'
>>>

OS: Fedora 35
Python: 3.10