Closed gdamjan closed 8 years ago
pyotp uses urllib to do the URI encoding. In python2, urllib doesn't have proper Unicode support; quote()
expects bytes where it should expect a string. The solution is to either switch to Python 3, or to encode your unicode strings into byte strings before passing them over to provisioning_uri()
.
I could make this behavior conditional on Python version in pyotp, but I would prefer not to.
or just document the deficiency of python2. that would be enough for me personally, since I already use python3 for my demo stuff.
This is a general deficiency of Python 2, and the traceback does indicate that the error occurs in the standard library, so I see no need to note it in our documentation. Thanks for reporting though.
the exception is:
the same code works in python3 and its
str
type (which is same as unicode) and seems to url-escape the string.I'm not sure what the standards say about it though?