Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with get_cipher #9

Closed
mfominov opened this issue Sep 28, 2021 · 4 comments
Closed

Error with get_cipher #9

mfominov opened this issue Sep 28, 2021 · 4 comments

Comments

@mfominov
Copy link

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?

@mfominov
Copy link
Author

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?

@kaotika
Copy link

kaotika commented Oct 15, 2021

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)

@mfominov
Copy link
Author

mfominov commented Oct 16, 2021

@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"])

@mfominov
Copy link
Author

@OdyX @kiorky thx guys, with your library i've created look plugin for ansible)
https://gist.github.com/mfominov/cf73c2c555e1ac05ca2b9049f2c1c292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants