Below is an end-to-end example of submitting a ExtractBarcode request using JavaScript (Python) programming language:

# Simple script to make and process the results of an ExtractBarcode request to the LEADTOOLS CloudServices.
# In order to run this script, the following changes will need to be added:
#	1) Place your Application ID in the appId variable.
#	2) Place your Application Password in the password variable
# The script will perform the following operations in order:
#	1)Perform an ExtractBarcode request to the LEADTOOLS CloudServices.  A successfully made request will return a unique identifier.
#	2)We will then query the services using the GUID -- if the file is finished processing, the body will contain all the
#	  request data.
#	3)We will take the json data that was returned, parse it, and display all the information that was returned.
# This script makes use of the Requests Python library.
# More information about this library can be found here:

import requests
import sys
import time

servicesUrl = ""

# The application ID.
appId = "Replace with Application ID"

# The application password.
password = "Replace with Application Password"

# The first page in the file to mark for processing
firstPage = 1

# Sending a value of -1 will indicate to the services that the rest of the pages in the file should be processed.
lastPage = -1

#A comma separated string of barcode symbologies. Passing an empty string will cause to service to use Popular by default. 
symbologies = "";

# We will be uploading the file via a URl.  Files can also be passed by adding a PostFile to the request.  Only 1 file will be accepted per request.
# The services will use the following priority when determining what a request is trying to do GUID > URL > Request Body Content
fileURL = ''
baseRecognitionUrl = '{}Recognition/ExtractBarcode?firstPage={}&lastPage={}&fileurl={}&symbologies={}'
formattedRecognitionUrl = baseRecognitionUrl.format(
    servicesUrl, firstPage, lastPage, fileURL, symbologies)
request =, auth=(appId, password))

# If uploading a file alongside the HTTP request
#baseRecognitionUrl ='{}Recognition/ExtractBarcode?firstPage={}&lastPage={}'
#formattedRecognitionUrl = baseRecognitionUrl.format(
#    servicesUrl,firstPage, lastPage)
#file = {'file' : open('path/to/file', 'rb')}
#request =
#    formattedRecognitionUrl, auth=(appId, password), files = file)

if request.status_code != 200:
    print("Error sending the conversion request")

# Grab the GUID from the Request
guid = request.text
print("Unique ID returned by the services: " + guid + "\n")

# Now, we need to Query the results
print("Now Querying Results....")
baseQueryUrl = '{}Query?id={}'
formattedQueryUrl = baseQueryUrl.format(servicesUrl, guid)

while True:  # Poll the services to determine if the request has finished processing
    request =, auth=(appId, password))
    returnedData = request.json()
    if returnedData['FileStatus'] != 100 and returnedData['FileStatus'] != 123:

print("File finished processing with file status: " +

if returnedData['FileStatus'] != 200:

    returnedJson = returnedData['RequestData']
    for requestObject in returnedJson:
        print("Service Type: " + requestObject['ServiceType'])
        if requestObject['ServiceType'] == 'Recognition' and requestObject['RecognitionType'] == 'Barcode':
            print("Barcode Data:")
            for barcodeData in requestObject['data']:
                print("Symbology: " + barcodeData['Symbology'])
                print("Value: " + barcodeData['Value'])
                print("Bounds: " + barcodeData['Bounds'])
                print("Rotation Angle: " +
except Exception as e:
    print("Failed to Parse JSON")