Skip to content

Commit e40aba0

Browse files
add new api to documentApi; create package and change to version 1.0.3
1 parent fa7fac2 commit e40aba0

File tree

22 files changed

+940
-154
lines changed

22 files changed

+940
-154
lines changed

asposehtmlcloud/api/html_api.py

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,113 @@ def __get_document_fragment_by_x_path_with_http_info(self, name, x_path, out_for
18011801
_request_timeout=params.get('_request_timeout'),
18021802
collection_formats=collection_formats)
18031803

1804+
1805+
def get_document_fragment_by_x_path_by_url(self, source_url, x_path, out_format, **kwargs):
1806+
"""Return list of HTML fragments matching the specified XPath query by the source page URL.
1807+
1808+
This method makes a synchronous HTTP request by default. To make an
1809+
asynchronous HTTP request, please pass async=True
1810+
1811+
:param bool async: Asynchronous request
1812+
:param str source_url: Source page URL. (required)
1813+
:param str x_path: XPath query string. (required)
1814+
:param str out_format: Output format. Possible values: 'plain' and 'json'. (required)
1815+
:return: File. If the method is called asynchronously, returns the request thread.
1816+
"""
1817+
kwargs['_return_http_data_only'] = True
1818+
if kwargs.get('async'):
1819+
return self.__get_document_fragment_by_x_path_by_url_with_http_info(source_url, x_path, out_format, **kwargs)
1820+
else:
1821+
(data) = self.__get_document_fragment_by_x_path_by_url_with_http_info(source_url, x_path, out_format, **kwargs)
1822+
return data
1823+
1824+
def __get_document_fragment_by_x_path_by_url_with_http_info(self, source_url, x_path, out_format, **kwargs):
1825+
"""Return list of HTML fragments matching the specified XPath query by the source page URL.
1826+
1827+
This method makes a synchronous HTTP request by default. To make an
1828+
asynchronous HTTP request, please pass async=True
1829+
1830+
:param bool async: Asynchronous request
1831+
:param str source_url: Source page URL. (required)
1832+
:param str x_path: XPath query string. (required)
1833+
:param str out_format: Output format. Possible values: 'plain' and 'json'. (required)
1834+
:return: File. If the method is called asynchronously, returns the request thread.
1835+
"""
1836+
1837+
all_params = ['source_url', 'x_path', 'out_format']
1838+
all_params.append('async')
1839+
all_params.append('_return_http_data_only')
1840+
all_params.append('_preload_content')
1841+
all_params.append('_request_timeout')
1842+
1843+
params = locals()
1844+
for key, val in six.iteritems(params['kwargs']):
1845+
if key not in all_params:
1846+
raise TypeError(
1847+
"Got an unexpected keyword argument '%s'"
1848+
" to method get_document_fragment_by_x_path_by_url" % key
1849+
)
1850+
params[key] = val
1851+
del params['kwargs']
1852+
# verify the required parameter 'source_url' is set
1853+
if ('source_url' not in params or
1854+
params['source_url'] is None):
1855+
raise ValueError("Missing the required parameter `source_url` when calling `get_document_fragment_by_x_path_by_url`")
1856+
# verify the required parameter 'x_path' is set
1857+
if ('x_path' not in params or
1858+
params['x_path'] is None):
1859+
raise ValueError("Missing the required parameter `x_path` when calling `get_document_fragment_by_x_path_by_url`")
1860+
# verify the required parameter 'out_format' is set
1861+
if ('out_format' not in params or
1862+
params['out_format'] is None):
1863+
raise ValueError("Missing the required parameter `out_format` when calling `get_document_fragment_by_x_path_by_url`")
1864+
1865+
collection_formats = {}
1866+
1867+
path_params = {}
1868+
if 'out_format' in params:
1869+
path_params['outFormat'] = params['out_format']
1870+
1871+
query_params = []
1872+
if 'source_url' in params:
1873+
query_params.append(('sourceUrl', params['source_url']))
1874+
if 'x_path' in params:
1875+
query_params.append(('xPath', params['x_path']))
1876+
1877+
header_params = {}
1878+
1879+
form_params = []
1880+
local_var_files = {}
1881+
1882+
body_params = None
1883+
# HTTP header `Accept`
1884+
header_params['Accept'] = self.api_client.select_header_accept(
1885+
['application/zip'])
1886+
1887+
# HTTP header `Content-Type`
1888+
header_params['Content-Type'] = self.api_client.select_header_content_type(
1889+
['application/json'])
1890+
1891+
# Authentication setting
1892+
auth_settings = []
1893+
1894+
return self.api_client.call_api(
1895+
'/html/fragments/{outFormat}', 'GET',
1896+
path_params,
1897+
query_params,
1898+
header_params,
1899+
body=body_params,
1900+
post_params=form_params,
1901+
files=local_var_files,
1902+
response_type='file',
1903+
auth_settings=auth_settings,
1904+
async=params.get('async'),
1905+
_return_http_data_only=params.get('_return_http_data_only'),
1906+
_preload_content=params.get('_preload_content', True),
1907+
_request_timeout=params.get('_request_timeout'),
1908+
collection_formats=collection_formats)
1909+
1910+
18041911
def get_document_images(self, name, **kwargs):
18051912
"""Return all HTML document images packaged as a ZIP archive.
18061913
@@ -1898,6 +2005,95 @@ def __get_document_images_with_http_info(self, name, **kwargs):
18982005
_request_timeout=params.get('_request_timeout'),
18992006
collection_formats=collection_formats)
19002007

2008+
def get_document_images_by_url(self, source_url, **kwargs):
2009+
"""Return all HTML page images packaged as a ZIP archive by the source page URL.
2010+
2011+
This method makes a synchronous HTTP request by default. To make an
2012+
asynchronous HTTP request, please pass async=True
2013+
2014+
:param bool async: Asynchronous request
2015+
:param str source_url: Source page URL. (required)
2016+
:return: File. If the method is called asynchronously, returns the request thread.
2017+
"""
2018+
kwargs['_return_http_data_only'] = True
2019+
if kwargs.get('async'):
2020+
return self.__get_document_images_by_url_with_http_info(source_url, **kwargs)
2021+
else:
2022+
(data) = self.__get_document_images_by_url_with_http_info(source_url, **kwargs)
2023+
return data
2024+
2025+
def __get_document_images_by_url_with_http_info(self, source_url, **kwargs):
2026+
"""Return all HTML page images packaged as a ZIP archive by the source page URL.
2027+
2028+
This method makes a synchronous HTTP request by default. To make an
2029+
asynchronous HTTP request, please pass async=True
2030+
2031+
:param bool async: Asynchronous request
2032+
:param str source_url: Source page URL. (required)
2033+
:return: File. If the method is called asynchronously, returns the request thread.
2034+
"""
2035+
2036+
all_params = ['source_url']
2037+
all_params.append('async')
2038+
all_params.append('_return_http_data_only')
2039+
all_params.append('_preload_content')
2040+
all_params.append('_request_timeout')
2041+
2042+
params = locals()
2043+
for key, val in six.iteritems(params['kwargs']):
2044+
if key not in all_params:
2045+
raise TypeError(
2046+
"Got an unexpected keyword argument '%s'"
2047+
" to method get_document_images_by_url" % key
2048+
)
2049+
params[key] = val
2050+
del params['kwargs']
2051+
# verify the required parameter 'source_url' is set
2052+
if ('source_url' not in params or
2053+
params['source_url'] is None):
2054+
raise ValueError("Missing the required parameter `source_url` when calling `get_document_images_by_url`")
2055+
2056+
collection_formats = {}
2057+
2058+
path_params = {}
2059+
2060+
query_params = []
2061+
if 'source_url' in params:
2062+
query_params.append(('sourceUrl', params['source_url']))
2063+
2064+
header_params = {}
2065+
2066+
form_params = []
2067+
local_var_files = {}
2068+
2069+
body_params = None
2070+
# HTTP header `Accept`
2071+
header_params['Accept'] = self.api_client.select_header_accept(
2072+
['application/zip'])
2073+
2074+
# HTTP header `Content-Type`
2075+
header_params['Content-Type'] = self.api_client.select_header_content_type(
2076+
['application/json'])
2077+
2078+
# Authentication setting
2079+
auth_settings = []
2080+
2081+
return self.api_client.call_api(
2082+
'/html/images/all', 'GET',
2083+
path_params,
2084+
query_params,
2085+
header_params,
2086+
body=body_params,
2087+
post_params=form_params,
2088+
files=local_var_files,
2089+
response_type='file',
2090+
auth_settings=auth_settings,
2091+
async=params.get('async'),
2092+
_return_http_data_only=params.get('_return_http_data_only'),
2093+
_preload_content=params.get('_preload_content', True),
2094+
_request_timeout=params.get('_request_timeout'),
2095+
collection_formats=collection_formats)
2096+
19012097
##########################################################
19022098
# OCR API
19032099
##########################################################
@@ -2527,3 +2723,4 @@ def __get_detect_html_keywords_by_url_with_http_info(self, source_url, **kwargs)
25272723
_preload_content=params.get('_preload_content', True),
25282724
_request_timeout=params.get('_request_timeout'),
25292725
collection_formats=collection_formats)
2726+
Binary file not shown.
8.88 KB
Binary file not shown.

0 commit comments

Comments
 (0)