veryfi


Nameveryfi JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/veryfi/veryfi-python
SummaryNone
upload_time2024-08-24 01:20:32
maintainerNone
docs_urlNone
authorVeryfi, Inc.
requires_pythonNone
licenseMIT
keywords veryfi veryfi.com ocr api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            https://veryfi.github.io/veryfi-python/reference/veryfi/


[![PyPI - version](https://img.shields.io/pypi/v/veryfi.svg)](https://pypi.python.org/pypi/veryfi/)
[![PyPI](https://img.shields.io/pypi/pyversions/veryfi.svg)](https://pypi.python.org/pypi/veryfi)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Test](https://github.com/veryfi/veryfi-python/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/veryfi/veryfi-python/actions/workflows/test.yml)

**veryfi** is a Python module for communicating with the [Veryfi OCR API](https://veryfi.com/api/)

## Installation

Install from PyPi using [pip](http://www.pip-installer.org/en/latest/), a
package manager for Python.


Install the package from PyPI:
```bash
pip install -U veryfi
```

## Getting Started

### Obtaining Client ID and user keys
If you don't have an account with Veryfi, please go ahead and register here: [https://hub.veryfi.com/signup/api/](https://hub.veryfi.com/signup/api/)

### Python API Client Library
The **veryfi** library can be used to communicate with Veryfi API. All available functionality is described here https://veryfi.github.io/veryfi-python/reference/veryfi/#client

Below is the sample script using **veryfi** to OCR and extract data from a document:

```python

from veryfi import Client

client_id = 'your_client_id'
client_secret = 'your_client_secret'
username = 'your_username'
api_key = 'your_password'

categories = ['Grocery', 'Utilities', 'Travel']
file_path = '/tmp/invoice.jpg'

# This submits document for processing (takes 3-5 seconds to get response)
veryfi_client = Client(client_id, client_secret, username, api_key)
response = veryfi_client.process_document(file_path, categories=categories)
response

# or with url
response = veryfi_client.process_document_url(url, external_id=some_id)
response
>>> {"abn_number": "",
  "account_number": "",
  "bill_to_address": "130 INTERSTATE BLVD, SUIT 21\nNASHEVILLE, NC 28806",
  "bill_to_name": "FAST ROOFING COMPANY, LLC",
  "card_number": "",
  "category": "Hardware Supplies",
  "currency_code": "USD",
  "date": "2019-08-01 00:00:00",
  "due_date": "2019-09-01",
  "discount": 0,
  "external_id": "",
  "id": 28933541012,
  "img_thumbnail_url": "https://scdn.veryfi.com/documents/5rb8d5q0-3ae0-4f55-a54b-c01a553ab2da_t.jpg",
  "img_url": "https://scdn.veryfi.com/documents/5rb8d5q0-3ae0-4f55-a54b-c01a553ab2da.pdf",
  "invoice_number": "1234568",
  "line_items": [
    {
      "date": "",
      "description": "SFTY TAGS LCKED OUT 250BX 426NS",
      "discount": 0,
      "order": 1,
      "price": 200.0,
      "quantity": 1,
      "reference": "",
      "sku": "PTW-901444",
      "tax": 0,
      "tax_rate": 0,
      "total": 200.00,
      "type": "purchase",
      "unit_of_measure": "pc"
    },
    {
      "date": "",
      "description": "WEDGE ANCHOR. PLATED",
      "discount": 0,
      "order": 2,
      "price": 3.75,
      "quantity": 100,
      "reference": "",
      "sku": "WA-12-414",
      "tax": 0,
      "tax_rate": 0,
      "total": 375.00,
      "unit_of_measure": "pc"
    },
    
    {
      "date": "",
      "description": "SYP #2 KD-HT UNTREATED",
      "discount": 0,
      "order": 9,
      "price": 11.49,
      "quantity": 1,
      "reference": "",
      "sku": "WE-27517",
      "tax": 0,
      "tax_rate": 0,
      "total": 11.49,
      "unit_of_measure": "pc"
    }
  ],
  "ocr_text": "\nACE\nThe helpful place.\nAce Hardware\t\t\t\t\t\tINVOICE\n5726.....",
  "payment_display_name": "",
  "payment_terms": "",
  "payment_type": "",
  "purchase_order_number": "",
  "reference_number": "VBAJD-32541",
  "shipping": 0,
  "subtotal": 586.49,
  "tax": 41.05,
  "tax_lines": [{
    "name": "state tax",
    "rate": 7.0,
    "total": 41.05
  }],
  "tip": 0,
  "total": 627.54,
  "vat_number": "",
  "vendor": {
    "address": "5726 Memorial Blvd, Saint George, SC 29477",
    "name": "Hutto Ace Hardware",
    "raw_name": "Ace Hardware",
    "phone_number": "(843) 563-4012",
    "vendor_logo": "https://cdn.veryfi.com/logos/us/953982859.png",
    "vendor_type": "hardware stores"
  },
  "vendor_vat_number":  "",
  "vendor_iban":  "",
  "vendor_bank_number":  "", 
  "vendor_bank_name": ""
}
``` 

Update a document
```
new_vendor = {"name": "Starbucks", "address": "123 Easy Str, San Francisco, CA 94158"}
category = "Meals & Entertainment"
new_total = 11.23
veryfi_client.update_document(id=12345, vendor=new_vendor, category=new_category, total=new_total)
```


## Need help?
Visit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal

If you run into any issue or need help installing or using the library, please contact support@veryfi.com.

If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!

To learn more about Veryfi visit https://www.veryfi.com/

## Tutorial Video

[![Watch 'Code with Dmitry' Video](https://img.youtube.com/vi/CwNkFxVEwuo/0.jpg)](https://www.youtube.com/watch?v=CwNkFxVEwuo&list=PLkA-lFc8JUY53MNgA5FWJSLXoW5PWBDfK&index=2)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/veryfi/veryfi-python",
    "name": "veryfi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "veryfi, veryfi.com, ocr api",
    "author": "Veryfi, Inc.",
    "author_email": "support@veryfi.com",
    "download_url": "https://files.pythonhosted.org/packages/92/be/a49fc68d4742835224887bac742f0a75a2cc093f06e63a54d38f2ec4bc63/veryfi-4.0.0.tar.gz",
    "platform": null,
    "description": "https://veryfi.github.io/veryfi-python/reference/veryfi/\n\n\n[![PyPI - version](https://img.shields.io/pypi/v/veryfi.svg)](https://pypi.python.org/pypi/veryfi/)\n[![PyPI](https://img.shields.io/pypi/pyversions/veryfi.svg)](https://pypi.python.org/pypi/veryfi)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Test](https://github.com/veryfi/veryfi-python/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/veryfi/veryfi-python/actions/workflows/test.yml)\n\n**veryfi** is a Python module for communicating with the [Veryfi OCR API](https://veryfi.com/api/)\n\n## Installation\n\nInstall from PyPi using [pip](http://www.pip-installer.org/en/latest/), a\npackage manager for Python.\n\n\nInstall the package from PyPI:\n```bash\npip install -U veryfi\n```\n\n## Getting Started\n\n### Obtaining Client ID and user keys\nIf you don't have an account with Veryfi, please go ahead and register here: [https://hub.veryfi.com/signup/api/](https://hub.veryfi.com/signup/api/)\n\n### Python API Client Library\nThe **veryfi** library can be used to communicate with Veryfi API. All available functionality is described here https://veryfi.github.io/veryfi-python/reference/veryfi/#client\n\nBelow is the sample script using **veryfi** to OCR and extract data from a document:\n\n```python\n\nfrom veryfi import Client\n\nclient_id = 'your_client_id'\nclient_secret = 'your_client_secret'\nusername = 'your_username'\napi_key = 'your_password'\n\ncategories = ['Grocery', 'Utilities', 'Travel']\nfile_path = '/tmp/invoice.jpg'\n\n# This submits document for processing (takes 3-5 seconds to get response)\nveryfi_client = Client(client_id, client_secret, username, api_key)\nresponse = veryfi_client.process_document(file_path, categories=categories)\nresponse\n\n# or with url\nresponse = veryfi_client.process_document_url(url, external_id=some_id)\nresponse\n>>> {\"abn_number\": \"\",\n  \"account_number\": \"\",\n  \"bill_to_address\": \"130 INTERSTATE BLVD, SUIT 21\\nNASHEVILLE, NC 28806\",\n  \"bill_to_name\": \"FAST ROOFING COMPANY, LLC\",\n  \"card_number\": \"\",\n  \"category\": \"Hardware Supplies\",\n  \"currency_code\": \"USD\",\n  \"date\": \"2019-08-01 00:00:00\",\n  \"due_date\": \"2019-09-01\",\n  \"discount\": 0,\n  \"external_id\": \"\",\n  \"id\": 28933541012,\n  \"img_thumbnail_url\": \"https://scdn.veryfi.com/documents/5rb8d5q0-3ae0-4f55-a54b-c01a553ab2da_t.jpg\",\n  \"img_url\": \"https://scdn.veryfi.com/documents/5rb8d5q0-3ae0-4f55-a54b-c01a553ab2da.pdf\",\n  \"invoice_number\": \"1234568\",\n  \"line_items\": [\n    {\n      \"date\": \"\",\n      \"description\": \"SFTY TAGS LCKED OUT 250BX 426NS\",\n      \"discount\": 0,\n      \"order\": 1,\n      \"price\": 200.0,\n      \"quantity\": 1,\n      \"reference\": \"\",\n      \"sku\": \"PTW-901444\",\n      \"tax\": 0,\n      \"tax_rate\": 0,\n      \"total\": 200.00,\n      \"type\": \"purchase\",\n      \"unit_of_measure\": \"pc\"\n    },\n    {\n      \"date\": \"\",\n      \"description\": \"WEDGE ANCHOR. PLATED\",\n      \"discount\": 0,\n      \"order\": 2,\n      \"price\": 3.75,\n      \"quantity\": 100,\n      \"reference\": \"\",\n      \"sku\": \"WA-12-414\",\n      \"tax\": 0,\n      \"tax_rate\": 0,\n      \"total\": 375.00,\n      \"unit_of_measure\": \"pc\"\n    },\n    \n    {\n      \"date\": \"\",\n      \"description\": \"SYP #2 KD-HT UNTREATED\",\n      \"discount\": 0,\n      \"order\": 9,\n      \"price\": 11.49,\n      \"quantity\": 1,\n      \"reference\": \"\",\n      \"sku\": \"WE-27517\",\n      \"tax\": 0,\n      \"tax_rate\": 0,\n      \"total\": 11.49,\n      \"unit_of_measure\": \"pc\"\n    }\n  ],\n  \"ocr_text\": \"\\nACE\\nThe helpful place.\\nAce Hardware\\t\\t\\t\\t\\t\\tINVOICE\\n5726.....\",\n  \"payment_display_name\": \"\",\n  \"payment_terms\": \"\",\n  \"payment_type\": \"\",\n  \"purchase_order_number\": \"\",\n  \"reference_number\": \"VBAJD-32541\",\n  \"shipping\": 0,\n  \"subtotal\": 586.49,\n  \"tax\": 41.05,\n  \"tax_lines\": [{\n    \"name\": \"state tax\",\n    \"rate\": 7.0,\n    \"total\": 41.05\n  }],\n  \"tip\": 0,\n  \"total\": 627.54,\n  \"vat_number\": \"\",\n  \"vendor\": {\n    \"address\": \"5726 Memorial Blvd, Saint George, SC 29477\",\n    \"name\": \"Hutto Ace Hardware\",\n    \"raw_name\": \"Ace Hardware\",\n    \"phone_number\": \"(843) 563-4012\",\n    \"vendor_logo\": \"https://cdn.veryfi.com/logos/us/953982859.png\",\n    \"vendor_type\": \"hardware stores\"\n  },\n  \"vendor_vat_number\":  \"\",\n  \"vendor_iban\":  \"\",\n  \"vendor_bank_number\":  \"\", \n  \"vendor_bank_name\": \"\"\n}\n``` \n\nUpdate a document\n```\nnew_vendor = {\"name\": \"Starbucks\", \"address\": \"123 Easy Str, San Francisco, CA 94158\"}\ncategory = \"Meals & Entertainment\"\nnew_total = 11.23\nveryfi_client.update_document(id=12345, vendor=new_vendor, category=new_category, total=new_total)\n```\n\n\n## Need help?\nVisit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal\n\nIf you run into any issue or need help installing or using the library, please contact support@veryfi.com.\n\nIf you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!\n\nTo learn more about Veryfi visit https://www.veryfi.com/\n\n## Tutorial Video\n\n[![Watch 'Code with Dmitry' Video](https://img.youtube.com/vi/CwNkFxVEwuo/0.jpg)](https://www.youtube.com/watch?v=CwNkFxVEwuo&list=PLkA-lFc8JUY53MNgA5FWJSLXoW5PWBDfK&index=2)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "4.0.0",
    "project_urls": {
        "Homepage": "https://github.com/veryfi/veryfi-python"
    },
    "split_keywords": [
        "veryfi",
        " veryfi.com",
        " ocr api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d92fc9358ab8d6a4334f62530c69d9570887e73438bb5df38bd0c0c23996015",
                "md5": "d5d765aabb5856075ec79c5acd2a2a6d",
                "sha256": "81676b734bd413650de99455646cb002e70905cdb93a7fdcd971936fd975a145"
            },
            "downloads": -1,
            "filename": "veryfi-4.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5d765aabb5856075ec79c5acd2a2a6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9659,
            "upload_time": "2024-08-24T01:20:30",
            "upload_time_iso_8601": "2024-08-24T01:20:30.926883Z",
            "url": "https://files.pythonhosted.org/packages/4d/92/fc9358ab8d6a4334f62530c69d9570887e73438bb5df38bd0c0c23996015/veryfi-4.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92bea49fc68d4742835224887bac742f0a75a2cc093f06e63a54d38f2ec4bc63",
                "md5": "a0410ed47d277011cc1f99090edb2fe2",
                "sha256": "9658df55abe8f86a8b0b2a425fc8783a9d17ed544f43316ad4db1984349291c6"
            },
            "downloads": -1,
            "filename": "veryfi-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a0410ed47d277011cc1f99090edb2fe2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2463821,
            "upload_time": "2024-08-24T01:20:32",
            "upload_time_iso_8601": "2024-08-24T01:20:32.269773Z",
            "url": "https://files.pythonhosted.org/packages/92/be/a49fc68d4742835224887bac742f0a75a2cc093f06e63a54d38f2ec4bc63/veryfi-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-24 01:20:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "veryfi",
    "github_project": "veryfi-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "veryfi"
}
        
Elapsed time: 0.34236s