Tag archive for: QR Code

How to use pycrypto, python-qrcode and Flask-RESTPlus to create QR codes that can send encrypted data to an endpoint

If you want to direct someone to a web page without saying a word, then you can use QR codes to do so.

For example, your QR code reader will direct your phone’s browser to visit our home page when you scan the following QR Code:

Techcoil home page QRCode

Given that, you can use QR codes to send HTTP requests to an endpoint of your HTTP server. In addition, you can embed data that you wish to send to the endpoint in the QR codes.

With this in mind, let’s look at how we can use pycrypto, python-qrcode and Flask-RESTPlus to create QR codes that can send encrypted data to an endpoint.

How to create an API endpoint that generates a QR Code image, with Python 3 Flask-RESTPlus and python-qrcode

When you have an API endpoint that generates a QR Code image, another device with a QR Code scanner will be able to get the encoded value to perform some action. For example, WhatsApp web generates a QR Code image that encodes a code for WhatsApp app to sign in the user.

So how can you create an API endpoint that generates a QR Code image? With this in mind, let’s look at how we can do so with Python 3 Flask-RESTPlus and python-qrcode.