Generate QRcode using Python

Generate QRcode using Python
Step 1: Download and Install Python
Step 2: Open CMD prompt and run the following command to install flask and pyqrcode module
>> pip install flask
>> pip install pyqrcode
Step 3: Open the new text document and place the following code
import io
from flask import Flask, send_file, request
import pyqrcode
@app.route(‘/qrcode’, methods=[‘GET’])
def search_data():
    query = request.args.get(‘query’, ”)
    qr = pyqrcode.create(query)
    qr.png(query+’.png’, scale=3)
    with open(query+’.png’, ‘rb’) as bites:
        return send_file(
if __name__ == “__main__”:  
Step 4: Save the file in .py format. (e.g.
Step 5: Deploy this python web app in Restful web service.
  • January 17, 2019 | 113 views
  • Comments