ewjoachim / bitwarden-keyring Goto Github PK
View Code? Open in Web Editor NEWImplementation of Bitwarden as keyring backend
License: Other
Implementation of Bitwarden as keyring backend
License: Other
I'm not using bitwarden, but on the computer of a friend, there is
File “/usr/local/lib/python3.11/site-packages/bitwarden_keyring/__init__.py”, line 8, in <module> from keyring.util import properties
ImportError: cannot import name ‘properties’ from ‘keyring.util’
This module was indeed removed
I don't know what it does, so I cannot recommand anything to fix this, but according to the deprecation warning that this commit removed
warnings.warn(
"Properties from keyring.util are no longer supported. "
"Use jaraco.classes.properties instead.",
DeprecationWarning,
)
I don't know what jaraco is, but I assume you can simply replace the problematic import with from jaraco.classes import properties
[me@centos7 tests]$ /usr/local/bin/pytest
======================================================================== test session starts =========================================================================
platform linux -- Python 3.6.8, pytest-5.1.1, py-1.8.0, pluggy-0.12.0 -- /usr/bin/python3.6
cachedir: .pytest_cache
rootdir: /home/tjyang/github/bitwarden-keyring, inifile: setup.cfg
plugins: cov-2.7.1
collected 0 items / 1 errors
Coverage.py warning: Module bitwarden_keyring was never imported. (module-not-imported)
Coverage.py warning: No data was collected. (no-data-collected)
WARNING: Failed to generate report: No data to report.
/usr/local/lib/python3.6/site-packages/pytest_cov/plugin.py:229: PytestWarning: Failed to generate report: No data to report.
self.cov_controller.finish()
=============================================================================== ERRORS ===============================================================================
__________________________________________________________ ERROR collecting tests/test_bitwarden_keyring.py __________________________________________________________
ImportError while importing test module '/home/tjyang/github/bitwarden-keyring/tests/test_bitwarden_keyring.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.6/site-packages/_pytest/python.py:501: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/local/lib/python3.6/site-packages/py/_path/local.py:701: in pyimport
__import__(modname)
/usr/local/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:140: in exec_module
exec(co, module.__dict__)
test_bitwarden_keyring.py:8: in <module>
import bitwarden_keyring as bwkr
E ModuleNotFoundError: No module named 'bitwarden_keyring'
----------- coverage: platform linux, python 3.6.8-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
---------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================== 1 error in 0.34s ==========================================================================
[me@centos7 tests]$
/home/me/github/bitwarden-keyring/tests
[me@centos7 tests]$
I can create a new item:
$ keyring set hello world
Password for 'world' in 'hello':
Created.
The bitwarden-cli shows the new item as expected: $ bw get item hello
But keyring get hello world
doesn't return anything. (It doesn't raise an error either.)
I'm on Win10 with bitwarden-cli version 2023.5.0. Could you help me to troubleshoot the issue? I don't know where to start.
I was getting the following error when trying to run it. I noticed the issue was caused by line 93-95 in init.py. Could be due to me using Windows/Python3.7.
I was able to fix the issue by setting encoding for subprocess and removing encoding for stdout.
However, I am still a bit confused about how to pull credentials properly. Can you please give me an example on how you would use bitwarden-keyring?
Thanks.
Hey Joachim,
Thanks for the module, I have been using it to build out a utility to allow me to easily search and copy my bitwarden passwords to clipboard with fzf for search.
I ran into a small issue while using the module where I want to built a username/password cache using the bw()
function, then using those results I call the get_password()
func. The issue I am having is it is repeatedly calling for a new session on each function call (which asks me for password each time to unlock), and there doesn't seem to be a way to pass the session to the get_password
, set_password
, or del_password
functions.
I am proposing the following, add a function input session=None
, then add a small check inside the function. If session == None
, it will grab the session from users password, else it will use the session passed to it.
I have created #4 with the additions, tests, and minor version bump. Wanted to write my thoughts out here as well.
Let me know if you know a better way.
Sorry for asking this.
Can you provide an python example that utilize this module ?
Because of this, it's likely that your setup and my setup are nothing alike. Keyring supports a configuration file with an option allowing to explicitely define the path to a backend. You may need that for your installation, or maybe not.
What exactly should I to write in config to specified keyring backend in python keyrign?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.