Closed max-rocket-internet closed 5 years ago
Seems reasonable
Here is a workaround for this that I used:
import contextlib
@contextlib.contextmanager
def capture():
import sys
from cStringIO import StringIO
oldout,olderr = sys.stdout, sys.stderr
try:
out=[StringIO(), StringIO()]
sys.stdout,sys.stderr = out
yield out
finally:
sys.stdout,sys.stderr = oldout, olderr
out[0] = out[0].getvalue()
out[1] = out[1].getvalue()
# A hack to suppress stdout statements in aws_google_auth during import
with capture() as out:
from aws_google_auth import _version, configuration, util, google, amazon
for line in out:
logger.info(line)
This could be a good starting point on this project @wcharaka
@mide I m trying get this issue fixed, realised that initial commits were from you. Just wanted to know the reasoning behind making the u2f optional. The quick fix is to add the python-u2flib-host
to the requirements so that the error wont throw any more.
If it's a negligible change to workflow, I think we could just collapse all the versions into one that has all the requirements. I can't think of a reason to keep them separate now, but as a disclosure I use U2F.
Looking back, it looks like I based my changes off https://github.com/cevoaustralia/aws-google-auth/pull/25, and that had the U2F break-apart there.
Support optionally installed with
pip install -e aws-google-auth[u2f]
, to avoid requiring dependency onpython-u2flib-host
.
I see in the latest version this is resolved 🎉 Thanks 💙
Currently in version
0.0.19
both with and without the--disable-u2f
you get an error message:Given how uncommon U2F is, could we disable it by default and not print the
Failed to import U2F libraries
error unless--enable-u2f
is passed?