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 translate English to German Text in Python using Deep Learning AI

Occam.fi 2021 — A Year in Review

Bring your own private IP addresses to the cloud using IBM Container Service — IBM Cloud Blog

MultiThreading and MultiProcessing Explained

GSOC2020 week 8–9

CoolDown in unity

Launching Your S3 Website Using AWS Route 53, Cloudfront and Your 3rd Party Registered Domain Name.

#IESS (Interswitch Engineering Spotlight Series) Debut Publication

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

Part-of-Speech Tag a String, Filter to Adverbs in Python

Easier Python Package Deploying

Extract Transform Load (ETL) process on Shopee data

DelayQueue in Python