I have a function that generates a QR image:
import qrcode def generateRandomQR(): qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4, ) qr.add_data("Huehue") qr.make(fit=True) img = qr.make_image() return img
now then the idea is to generate an image and then drop it on the bulb to serve as the image, this is my function for the bulb:
@app.route("/qrgenerator/image.jpg") def generateQRImage(): response = make_response(qrWrapper.generateRandomQR()) response.headers["Content-Type"] = "image/jpeg" response.headers["Content-Disposition"] = "attachment; filename=image.jpg" return response
But it looks like it is working fine ... I find a 500 error, so I'm not quite sure what I'm doing wrong.
source share