Open ericmjl opened 5 years ago
You can use:
import pyqrcode
qrcode = pyqrcode.create('Test')
encoded = qrcode.png_as_base64_str()
Note: The returned string is actually not a valid data URI. PyQRCode 1.3.0 provides QrCode.png_data_uri()
which returns a data URI.
See https://github.com/heuer/pyqrcode/blob/master/CHANGES.rst
($ pip install git+https://github.com/heuer/pyqrcode.git@1.3.0
)
Thanks @heuer for the information! I must have missed this, because I didn't see it in the docs. Is there a timeline for release to PyPI?
Is there a timeline for release to PyPI?
No, unfortunately I don't have access to the PyPI project, see issue #52
@heuer reading through the issue, just wanted to say a big thanks for being willing to take over the project. I put in a comment on https://github.com/pypa/warehouse/issues/4121 to support your case for taking over pyqrcode, I hope it pushes things along.
I wanted to discuss this feature PR before actually taking any action.
One application I wanted was to be able to take the generated QR code and display it on an HTML page, without writing anything to disk.
As it turns out, this is possible:
I was wondering if you might be interested in accepting a PR that defines the following API?
The underlying implementation would essentially use the aforementioned code:
Please let me know, I'm happy to work on the PR for this. Alternatively, if you're not interested in this, no hard feelings too :smile:.