Skip to content

Commit

Permalink
4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloudmersive committed Mar 27, 2023
1 parent 73717fa commit 90acf41
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 35 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: 3.0.1
- Package version: 4.0.1
- Build package: io.swagger.codegen.languages.PythonClientCodegen

## Requirements.
Expand Down Expand Up @@ -87,6 +87,7 @@ Class | Method | HTTP request | Description
*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
*ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
*PdfOcrApi* | [**pdf_ocr_get_async_job_status**](docs/PdfOcrApi.md#pdf_ocr_get_async_job_status) | **GET** /ocr/pdf/get-job-status | Returns the result of the Async Job - possible states can be STARTED or COMPLETED
*PdfOcrApi* | [**pdf_ocr_pdf_to_lines_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_lines_with_location) | **POST** /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location
*PdfOcrApi* | [**pdf_ocr_pdf_to_words_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_words_with_location) | **POST** /ocr/pdf/to/words-with-location | Convert a PDF into words with location
*PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file into text via Optical Character Recognition.
Expand Down
36 changes: 18 additions & 18 deletions cloudmersive_ocr_api_client/api/image_ocr_api.py

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions cloudmersive_ocr_api_client/api/pdf_ocr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,99 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client

def pdf_ocr_get_async_job_status(self, async_job_id, **kwargs): # noqa: E501
"""Returns the result of the Async Job - possible states can be STARTED or COMPLETED # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pdf_ocr_get_async_job_status(async_job_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str async_job_id: (required)
:return: PdfToTextResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.pdf_ocr_get_async_job_status_with_http_info(async_job_id, **kwargs) # noqa: E501
else:
(data) = self.pdf_ocr_get_async_job_status_with_http_info(async_job_id, **kwargs) # noqa: E501
return data

def pdf_ocr_get_async_job_status_with_http_info(self, async_job_id, **kwargs): # noqa: E501
"""Returns the result of the Async Job - possible states can be STARTED or COMPLETED # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pdf_ocr_get_async_job_status_with_http_info(async_job_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str async_job_id: (required)
:return: PdfToTextResponse
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['async_job_id'] # 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 pdf_ocr_get_async_job_status" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'async_job_id' is set
if ('async_job_id' not in params or
params['async_job_id'] is None):
raise ValueError("Missing the required parameter `async_job_id` when calling `pdf_ocr_get_async_job_status`") # noqa: E501

collection_formats = {}

path_params = {}

query_params = []
if 'async_job_id' in params:
query_params.append(('AsyncJobID', params['async_job_id'])) # noqa: E501

header_params = {}

form_params = []
local_var_files = {}

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

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

return self.api_client.call_api(
'/ocr/pdf/get-job-status', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='PdfToTextResponse', # 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 pdf_ocr_pdf_to_lines_with_location(self, image_file, **kwargs): # noqa: E501
"""Convert a PDF into text lines with location # 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/3.0.1/python'
self.user_agent = 'Swagger-Codegen/4.0.1/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 @@ -248,5 +248,5 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: v1\n"\
"SDK Package Version: 3.0.1".\
"SDK Package Version: 4.0.1".\
format(env=sys.platform, pyversion=sys.version)
62 changes: 59 additions & 3 deletions cloudmersive_ocr_api_client/models/pdf_to_text_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,35 @@ class PdfToTextResponse(object):
"""
swagger_types = {
'successful': 'bool',
'ocr_pages': 'list[OcrPageResult]'
'ocr_pages': 'list[OcrPageResult]',
'async_job_id': 'str',
'async_job_status': 'str'
}

attribute_map = {
'successful': 'Successful',
'ocr_pages': 'OcrPages'
'ocr_pages': 'OcrPages',
'async_job_id': 'AsyncJobID',
'async_job_status': 'AsyncJobStatus'
}

def __init__(self, successful=None, ocr_pages=None): # noqa: E501
def __init__(self, successful=None, ocr_pages=None, async_job_id=None, async_job_status=None): # noqa: E501
"""PdfToTextResponse - a model defined in Swagger""" # noqa: E501

self._successful = None
self._ocr_pages = None
self._async_job_id = None
self._async_job_status = None
self.discriminator = None

if successful is not None:
self.successful = successful
if ocr_pages is not None:
self.ocr_pages = ocr_pages
if async_job_id is not None:
self.async_job_id = async_job_id
if async_job_status is not None:
self.async_job_status = async_job_status

@property
def successful(self):
Expand Down Expand Up @@ -98,6 +108,52 @@ def ocr_pages(self, ocr_pages):

self._ocr_pages = ocr_pages

@property
def async_job_id(self):
"""Gets the async_job_id of this PdfToTextResponse. # noqa: E501
When the job exceeds 25 pages, an Async Job ID is returned. Use the CheckPdfOcrJobStatus API to check on the status of this job using the AsyncJobID and get the result when it finishes # noqa: E501
:return: The async_job_id of this PdfToTextResponse. # noqa: E501
:rtype: str
"""
return self._async_job_id

@async_job_id.setter
def async_job_id(self, async_job_id):
"""Sets the async_job_id of this PdfToTextResponse.
When the job exceeds 25 pages, an Async Job ID is returned. Use the CheckPdfOcrJobStatus API to check on the status of this job using the AsyncJobID and get the result when it finishes # noqa: E501
:param async_job_id: The async_job_id of this PdfToTextResponse. # noqa: E501
:type: str
"""

self._async_job_id = async_job_id

@property
def async_job_status(self):
"""Gets the async_job_status of this PdfToTextResponse. # noqa: E501
Returns the job status of the Async Job, if applicable. Possible states are STARTED and COMPLETED # noqa: E501
:return: The async_job_status of this PdfToTextResponse. # noqa: E501
:rtype: str
"""
return self._async_job_status

@async_job_status.setter
def async_job_status(self, async_job_status):
"""Sets the async_job_status of this PdfToTextResponse.
Returns the job status of the Async Job, if applicable. Possible states are STARTED and COMPLETED # noqa: E501
:param async_job_status: The async_job_status of this PdfToTextResponse. # noqa: E501
:type: str
"""

self._async_job_status = async_job_status

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
Expand Down
18 changes: 9 additions & 9 deletions docs/ImageOcrApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Method | HTTP request | Description
Convert a scanned image into words with location

Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -78,7 +78,7 @@ Name | Type | Description | Notes
Convert a scanned image into words with location

Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -136,7 +136,7 @@ Name | Type | Description | Notes
Recognize a photo of a business card, extract key business information

Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -190,7 +190,7 @@ Name | Type | Description | Notes
Recognize a photo of a form, extract key fields and business information

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.
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. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -254,7 +254,7 @@ Name | Type | Description | Notes
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
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. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -318,7 +318,7 @@ Name | Type | Description | Notes
Recognize a photo of a receipt, extract key business information

Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -378,7 +378,7 @@ Name | Type | Description | Notes
Convert a photo of a document into text

Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -436,7 +436,7 @@ Name | Type | Description | Notes
Convert a photo of a document or receipt into words with location

Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on photographs of documents. If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case.
Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on photographs of documents. If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down Expand Up @@ -498,7 +498,7 @@ Name | Type | Description | Notes
Convert a scanned image into text

Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first. Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

### Example
```python
Expand Down
Loading

0 comments on commit 90acf41

Please sign in to comment.