Error with get_cipher
mfominov opened this issue · 4 comments
First of all, thx a lot for this library.
I'm trying to use it on self hosted vaultwarden instance and faced an issue.
code
cipher = client.get_cipher(item_or_id_or_name="elk", collection=col, orga=orga)
error
Traceback (most recent call last): File "main.py", line 21, in <module> cipher = client.get_cipher(item_or_id_or_name="elk", collection=col, orga=orga) File "/home/vscode/.local/lib/python3.8/site-packages/bitwardentools/client.py", line 1883, in get_cipher ret = ret[0] TypeError: 'odict_values' object is not subscriptable
Can u help me?
By with as_list=True i have an output.
odict_values([<bitwardentools.client.Login object at 0xffffb49c7d90>])
But how to get a values inside of object?
Thanks @mfominov . as_list=True
helped. But I needed to mangle around with the result to get the real cipher.
cipher_list = client.get_cipher(item_or_id_or_name="elk", as_list=True)
cipher = list(cipher_list)[0]
print(cipher.id)
@kaotika thx)
cipher_list = client.get_cipher(
"elk", collection=col, orga=orga, as_list=True, sync=True
)
cipher = list(cipher_list)[0]
print(cipher.data["username"])
print(cipher.data["password"])
@OdyX @kiorky thx guys, with your library i've created look plugin for ansible)
https://gist.github.com/mfominov/cf73c2c555e1ac05ca2b9049f2c1c292