Generate a QR code barcode as PNG File in Python

QR Codes are one of the most common forms of barcode, providing rapid access to specific information about a product or service for anyone with a device capable of scanning it (i.e., smartphones). The ability to generate these QR codes quickly is a very useful function for a variety of business needs and the Cloudmersive Barcode API makes it easy to do. Specifically, the /barcode/generate/qrcode iteration of the Cloudmersive Barcode API enables you to generate a QR Barcode in PNG file format, encoding free-form text input of your choosing. Let’s look at how you can run this API in Python.

The first thing we’ll need to do is run the SDK installation command:

pip install cloudmersive-barcode-api-clientfrom __future__ import print_function
import time
import cloudmersive_barcode_api_client
from cloudmersive_barcode_api_client.rest import ApiException
from pprint import pprint

After that, we can move on to the meat & potatoes. All you have to do is copy in the API authorization key and the callback function. The below code is documented & ready to run for your convenience.

# Configure API key authorization: Apikey
configuration = cloudmersive_barcode_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_barcode_api_client.GenerateBarcodeApi(cloudmersive_barcode_api_client.ApiClient(configuration))
value = 'value_example' # str | QR code text to convert into the QR code barcode
try:
# Generate a QR code barcode as PNG file
api_response = api_instance.generate_barcode_qr_code(value)
pprint(api_response)
except ApiException as e:
print("Exception when calling GenerateBarcodeApi->generate_barcode_qr_code: %s\n" % e)

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Continuation (Observable Marriage Proposal to Observer) of Dialogue between Rx Observable and a…

5 Vital Tips of Backup Strategies in SQL Server that You Can Exploit

Extracting Service Configuration in Dotnet core 5

Codable in Swift4

slither.io APK Download

Testing Your Python API App with JSON Schema

Implementing a Distraction Mechanic

Creating a Win Screen in Unity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Protect Text Input from XML External Entity (XXE) Attacks in Node.js

Advanced Data Generator 4: First Look

Trying out MongoDB

Nexus Installation In Linux Centos