Skip to content

Commit

Permalink
2.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloudmersive committed Oct 21, 2019
1 parent a0a8d91 commit 9ed5465
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The powerful Optical Character Recognition (OCR) APIs let you convert scanned im
This Python package provides a native API client for [Cloudmersive OCR](https://www.cloudmersive.com/ocr-api)

- API version: v1
- Package version: 2.1.3
- Package version: 2.1.4
- Build package: io.swagger.codegen.languages.PythonClientCodegen

## Requirements.
Expand Down Expand Up @@ -82,6 +82,7 @@ Class | Method | HTTP request | Description
*ImageOcrApi* | [**image_ocr_image_words_with_location**](docs/ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
*ImageOcrApi* | [**image_ocr_photo_recognize_business_card**](docs/ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
*ImageOcrApi* | [**image_ocr_photo_recognize_form**](docs/ImageOcrApi.md#image_ocr_photo_recognize_form) | **POST** /ocr/photo/recognize/form | Recognize a photo of a form, extract key fields and business information
*ImageOcrApi* | [**image_ocr_photo_recognize_form_advanced**](docs/ImageOcrApi.md#image_ocr_photo_recognize_form_advanced) | **POST** /ocr/photo/recognize/form/advanced | Recognize a photo of a form, extract key fields using stored templates
*ImageOcrApi* | [**image_ocr_photo_recognize_receipt**](docs/ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
*ImageOcrApi* | [**image_ocr_photo_to_text**](docs/ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
*ImageOcrApi* | [**image_ocr_photo_words_with_location**](docs/ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
Expand Down
115 changes: 115 additions & 0 deletions cloudmersive_ocr_api_client/api/image_ocr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,121 @@ def image_ocr_photo_recognize_form_with_http_info(self, image_file, **kwargs):
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def image_ocr_photo_recognize_form_advanced(self, image_file, **kwargs): # noqa: E501
"""Recognize a photo of a form, extract key fields using stored templates # noqa: E501
Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.image_ocr_photo_recognize_form_advanced(image_file, async_req=True)
>>> result = thread.get()
:param async_req bool
:param file image_file: Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. (required)
:param str bucket_id: Bucket ID of the Configuration Bucket storing the form templates
:param str bucket_secret_key: Bucket Secret Key of the Configuration Bucket storing the form templates
:param str recognition_mode: Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
:param str preprocessing: Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
:return: FormRecognitionResult
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.image_ocr_photo_recognize_form_advanced_with_http_info(image_file, **kwargs) # noqa: E501
else:
(data) = self.image_ocr_photo_recognize_form_advanced_with_http_info(image_file, **kwargs) # noqa: E501
return data

def image_ocr_photo_recognize_form_advanced_with_http_info(self, image_file, **kwargs): # noqa: E501
"""Recognize a photo of a form, extract key fields using stored templates # noqa: E501
Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.image_ocr_photo_recognize_form_advanced_with_http_info(image_file, async_req=True)
>>> result = thread.get()
:param async_req bool
:param file image_file: Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. (required)
:param str bucket_id: Bucket ID of the Configuration Bucket storing the form templates
:param str bucket_secret_key: Bucket Secret Key of the Configuration Bucket storing the form templates
:param str recognition_mode: Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
:param str preprocessing: Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
:return: FormRecognitionResult
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['image_file', 'bucket_id', 'bucket_secret_key', 'recognition_mode', 'preprocessing'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')

params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method image_ocr_photo_recognize_form_advanced" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'image_file' is set
if ('image_file' not in params or
params['image_file'] is None):
raise ValueError("Missing the required parameter `image_file` when calling `image_ocr_photo_recognize_form_advanced`") # noqa: E501

collection_formats = {}

path_params = {}

query_params = []

header_params = {}
if 'bucket_id' in params:
header_params['bucketID'] = params['bucket_id'] # noqa: E501
if 'bucket_secret_key' in params:
header_params['bucketSecretKey'] = params['bucket_secret_key'] # noqa: E501
if 'recognition_mode' in params:
header_params['recognitionMode'] = params['recognition_mode'] # noqa: E501
if 'preprocessing' in params:
header_params['preprocessing'] = params['preprocessing'] # noqa: E501

form_params = []
local_var_files = {}
if 'image_file' in params:
local_var_files['imageFile'] = params['image_file'] # noqa: E501

body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'text/json', 'application/xml', 'text/xml']) # noqa: E501

# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['multipart/form-data']) # noqa: E501

# Authentication setting
auth_settings = ['Apikey'] # noqa: E501

return self.api_client.call_api(
'/ocr/photo/recognize/form/advanced', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='FormRecognitionResult', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def image_ocr_photo_recognize_receipt(self, image_file, **kwargs): # noqa: E501
"""Recognize a photo of a receipt, extract key business information # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion cloudmersive_ocr_api_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/2.1.3/python'
self.user_agent = 'Swagger-Codegen/2.1.4/python'

def __del__(self):
if self._pool is not None:
Expand Down
2 changes: 1 addition & 1 deletion cloudmersive_ocr_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: v1\n"\
"SDK Package Version: 2.1.3".\
"SDK Package Version: 2.1.4".\
format(env=sys.platform, pyversion=sys.version)
63 changes: 63 additions & 0 deletions docs/ImageOcrApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Method | HTTP request | Description
[**image_ocr_image_words_with_location**](ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
[**image_ocr_photo_recognize_business_card**](ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
[**image_ocr_photo_recognize_form**](ImageOcrApi.md#image_ocr_photo_recognize_form) | **POST** /ocr/photo/recognize/form | Recognize a photo of a form, extract key fields and business information
[**image_ocr_photo_recognize_form_advanced**](ImageOcrApi.md#image_ocr_photo_recognize_form_advanced) | **POST** /ocr/photo/recognize/form/advanced | Recognize a photo of a form, extract key fields using stored templates
[**image_ocr_photo_recognize_receipt**](ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
[**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
[**image_ocr_photo_words_with_location**](ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
Expand Down Expand Up @@ -246,6 +247,68 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **image_ocr_photo_recognize_form_advanced**
> FormRecognitionResult image_ocr_photo_recognize_form_advanced(image_file, bucket_id=bucket_id, bucket_secret_key=bucket_secret_key, recognition_mode=recognition_mode, preprocessing=preprocessing)
Recognize a photo of a form, extract key fields using stored templates

Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket

### Example
```python
from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = cloudmersive_ocr_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Apikey'] = 'Bearer'

# create an instance of the API class
api_instance = cloudmersive_ocr_api_client.ImageOcrApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
bucket_id = 'bucket_id_example' # str | Bucket ID of the Configuration Bucket storing the form templates (optional)
bucket_secret_key = 'bucket_secret_key_example' # str | Bucket Secret Key of the Configuration Bucket storing the form templates (optional)
recognition_mode = 'recognition_mode_example' # str | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. (optional)
preprocessing = 'preprocessing_example' # str | Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement. (optional)

try:
# Recognize a photo of a form, extract key fields using stored templates
api_response = api_instance.image_ocr_photo_recognize_form_advanced(image_file, bucket_id=bucket_id, bucket_secret_key=bucket_secret_key, recognition_mode=recognition_mode, preprocessing=preprocessing)
pprint(api_response)
except ApiException as e:
print("Exception when calling ImageOcrApi->image_ocr_photo_recognize_form_advanced: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**image_file** | **file**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
**bucket_id** | **str**| Bucket ID of the Configuration Bucket storing the form templates | [optional]
**bucket_secret_key** | **str**| Bucket Secret Key of the Configuration Bucket storing the form templates | [optional]
**recognition_mode** | **str**| Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. | [optional]
**preprocessing** | **str**| Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement. | [optional]

### Return type

[**FormRecognitionResult**](FormRecognitionResult.md)

### Authorization

[Apikey](../README.md#Apikey)

### HTTP request headers

- **Content-Type**: multipart/form-data
- **Accept**: application/json, text/json, application/xml, text/xml

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **image_ocr_photo_recognize_receipt**
> ReceiptRecognitionResult image_ocr_photo_recognize_receipt(image_file, recognition_mode=recognition_mode, language=language, preprocessing=preprocessing)
Expand Down
2 changes: 1 addition & 1 deletion packageconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projectName" : "cloudmersive_ocr_api_client",
"packageName" : "cloudmersive_ocr_api_client",
"packageVersion": "2.1.3",
"packageVersion": "2.1.4",
"packageUrl": "https://www.cloudmersive.com/ocr-api"
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "cloudmersive_ocr_api_client"
VERSION = "2.1.3"
VERSION = "2.1.4"
# To install the library, run the following
#
# python setup.py install
Expand Down

0 comments on commit 9ed5465

Please sign in to comment.