15 lines
367 B
Plaintext
15 lines
367 B
Plaintext
import io, urllib.parse
|
|
import qrcode
|
|
from aiohttp import web
|
|
|
|
data = params_kw.get('data', '')
|
|
if not data:
|
|
return web.Response(status=400, text='missing data')
|
|
|
|
data = urllib.parse.unquote(data)
|
|
img = qrcode.make(data, box_size=10, border=2)
|
|
buf = io.BytesIO()
|
|
img.save(buf, format='PNG')
|
|
buf.seek(0)
|
|
return web.Response(body=buf.read(), content_type='image/png')
|