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)

--

--

--

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

How To Decide Between Cloud And On-Premise Digital Signage

Python script for automating file rename

That’s a Wrap! A successful crowdfunding campaign for Hylo

Deploy WSO2 DS or DAS on Custom Docker in WSO2 Integration Cloud — Part 2

Unity3D Basics — Instantiating and Destroying.

Parse Args in Bash Scripts

Kubernetes: from load balancer to pod

How to Scan a File for Viruses in Java (Basic Version)

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

Convert a SQL Server Backup (.BAK) File into CSV for a Specified Table in Python

Python — JSONDecodeError

Collecting one-time event data with Deephaven and Prometheus

How to write integration tests against 🔥 FHIR in Python 🐍