Cloudmersive
2 min readDec 22, 2021

Lookup EAN Barcode Value, Return Product Data in Python

EAN Barcodes are an extremely common way to mark & track products being shipped from one place to another. As a result, it makes sense to have the ability to process barcode information quickly — and thankfully, there’s an API for that! The BarcodeLookup service of the Barcode API takes an EAN barcode input and returns important information about the product in the blink of an eye. In this article, we’ll walk through how to connect to this API in Python.

To get started, the first thing we’ll need to do is install the Python SDK. You can use the below snippet for that:

from __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 step, we can copy in the code snippet for our API authorization key input:

# Configure API key authorization: Apikey configuration = cloudmersive_barcode_api_client.Configuration() configuration.api_key['Apikey'] = 'YOUR_API_KEY'

Now let’s add in our return function to make the API call. Just copy & paste and you’re ready to run!

# create an instance of the API class
api_instance = cloudmersive_barcode_api_client.BarcodeLookupApi(cloudmersive_barcode_api_client.ApiClient(configuration))
value = 'value_example' # str | Barcode value
try:
# Lookup EAN barcode value, return product data
api_response = api_instance.barcode_lookup_ean_lookup(value)
pprint(api_response)
except ApiException as e:
print("Exception when calling BarcodeLookupApi->barcode_lookup_ean_lookup: %s\n" % e)
Figure 1. BarcodeLookup Response Model
Cloudmersive

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