Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # works for werkzerg, not for gunicorn
- @expose('/qrcode/<string:text>')
- @has_access
- def qrcode(self, text):
- qr = qrcode.QRCode(
- version=4,
- error_correction=qrcode.constants.ERROR_CORRECT_H,
- box_size=10,
- border=1)
- qr.add_data(text)
- img = qr.make_image()
- byte_io = BytesIO()
- img.save(byte_io, 'PNG')
- byte_io.seek(0)
- return send_file(byte_io, mimetype="image/png")
- 2018-02-22 16:27:52,377:ERROR:gunicorn.error:Error handling request
- Traceback (most recent call last):
- File "/usr/lib/pymodules/python2.7/gunicorn/workers/sync.py", line 102, in handle_request
- resp.write_file(respiter)
- File "/usr/lib/pymodules/python2.7/gunicorn/http/wsgi.py", line 285, in write_file
- fileno = respiter.filelike.fileno()
- UnsupportedOperation: fileno
Add Comment
Please, Sign In to add comment