Created
June 15, 2013 09:53
-
-
Save sysr-q/5787586 to your computer and use it in GitHub Desktop.
Generate on-the-fly QR codes, and send them out via Flask.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from flask import Flask, send_file | |
import qrcode | |
from StringIO import StringIO | |
app = Flask(__name__) | |
@app.route("/qr/<path:url>") | |
@app.route("/qr") | |
def qr_route(url="http://dongcorp.org"): | |
qr = qrcode.make(url) | |
img = StringIO() | |
qr.save(img) | |
img.seek(0) | |
return send_file(img, mimetype="image/png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment