ByteScout Cloud API Server - Barcode Reader API - Python - Read Barcode From URL - ByteScout

ByteScout Cloud API Server – Barcode Reader API – Python – Read Barcode From URL

  • Home
  • /
  • Articles
  • /
  • ByteScout Cloud API Server – Barcode Reader API – Python – Read Barcode From URL

How to read barcode from URL for barcode reader API in Python using ByteScout Cloud API Server

Learn in simple ways: How to read barcode from URL for barcode reader API in Python

Writing of the code to read barcode from URL in Python can be done by developers of any level using ByteScout Cloud API Server. Barcode reader API in Python can be applied with ByteScout Cloud API Server. ByteScout Cloud API Server is the ready to use Web API Server that can be deployed in less than 30 minutes into your own in-house server or into private cloud server. Can store data on in-house local server based storage or in Amazon AWS S3 bucket. Processing data solely on the server using buil-in ByteScout powered engine, no cloud services are used to process your data!.

Want to learn quickly? These fast application programming interfaces of ByteScout Cloud API Server for Python plus the instruction and the code below will help to learn how to read barcode from URL. This Python sample code can be used by copying and pasting into your project. Once done,just compile your project and click Run. You can use these Python sample examples in one or many applications.

Trial version of ByteScout is available for free download from our website. This and other source code samples for Python and other programming languages are available.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

ReadBarcodeFromUrl.py
      
import os import requests # pip install requests # Please NOTE: In this sample we're assuming Cloud Api Server is hosted at "https://localhost". # If it's not then please replace this with with your hosting url. # Base URL for PDF.co Web API requests BASE_URL = "https://localhost" # Direct URL of source file to search barcodes in. SourceFileURL = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/barcode-reader/sample.pdf" # Comma-separated list of barcode types to search. # See valid barcode types in the documentation https://app.pdf.co/documentation/api/1.0/barcode/read_from_url.html BarcodeTypes = "Code128,Code39,Interleaved2of5,EAN13" # Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. Pages = "" def main(args=None): readBarcodes(SourceFileURL) def readBarcodes(uploadedFileUrl): """Get Barcode Information using PDF.co Web API""" # Prepare URL for 'Barcode Reader' API request url = "{}/barcode/read/from/url?types={}&pages={}&url={}".format( BASE_URL, BarcodeTypes, Pages, uploadedFileUrl ) # Execute request and get response as JSON response = requests.get(url, headers={ "content-type": "application/octet-stream"}) if (response.status_code == 200): json = response.json() if json["error"] == False: # Display information for barcode in json["barcodes"]: print("Found barcode:") print(f" Type: {barcode['TypeName']}") print(f" Value: {barcode['Value']}") print(f" Document Page Index: {barcode['Page']}") print(f" Rectangle: {barcode['Rect']}") print(f" Confidence: {barcode['Confidence']}") print("") else: # Show service reported error print(json["message"]) else: print(f"Request error: {response.status_code} {response.reason}") if __name__ == '__main__': main()

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Cloud API Server Home Page

Explore ByteScout Cloud API Server Documentation

Explore Samples

Sign Up for ByteScout Cloud API Server Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Cloud API Server Home Page

Explore ByteScout Cloud API Server Documentation

Explore Samples

Sign Up for ByteScout Cloud API Server Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next