How to get invoice info from URL for invoice parser API in Python and PDF.co Web API

How to get invoice info from URL for invoice parser API in Python: Step By Step Instructions

This page displays the code samples for programming in Python. PDF.co Web API was designed to assist invoice parser API in Python. PDF.co Web API is the Rest API that provides set of data extraction functions, tools for documents manipulation, splitting and merging of pdf files. Includes built-in OCR, images recognition, can generate and read barcodes from images, scans and pdf.

This simple and easy to understand sample source code in Python for PDF.co Web API contains different functions and options you should do calling the API to implement invoice parser API. This Python sample code can be used by copying and pasting into your project. Once done,just compile your project and click Run. Enjoy writing a code with ready-to-use sample Python codes to add invoice parser API functions using PDF.co Web API in Python.

Our website provides free trial version of PDF.co Web API that gives source code samples to assist with your Python project.

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

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

GetInvoiceInfoFromUrl.py

      
import os import requests # pip install requests # The authentication key (API Key). # Get your own by registering at https://app.pdf.co/documentation/api API_KEY = "******************************************" # Base URL for PDF.co Web API requests BASE_URL = "https://api.pdf.co/v1" # Direct URL of PDF file to get information SourceFileURL = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-to-json/sample.pdf" def main(args=None): getInfoFromUrl(SourceFileURL) def getInfoFromUrl(uploadedFileUrl): """Get Information using PDF.co Web API""" # Prepare requests params as JSON # See documentation: https://apidocs.pdf.co parameters = {} parameters["url"] = uploadedFileUrl parameters["inline"] = True # Prepare URL for 'invoice info' API request url = "{}/pdf/invoiceparser".format(BASE_URL) # Execute request and get response as JSON response = requests.post(url, data=parameters, headers={ "x-api-key": API_KEY }) if (response.status_code == 200): json = response.json() if json["error"] == False: # Display information print(json["body"]) else: # Show service reported error print(json["message"]) else: print(f"Request error: {response.status_code} {response.reason}") if __name__ == '__main__': main()

VIDEO

ON-PREMISE OFFLINE SDK

Get 60 Day Free Trial

See also:

ON-DEMAND REST WEB API

Get Your API Key

See also: