Skip to content

Commit f461fed

Browse files
committed
Deprecate document conversion
1 parent d7709aa commit f461fed

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

watson_developer_cloud/document_conversion_v1.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,19 @@
1616
The v1 Document Conversion service
1717
(https://www.ibm.com/watson/developercloud/document-conversion.html)
1818
"""
19+
import warnings
1920
from .watson_service import WatsonService
2021
import os
2122
import json
2223

24+
def deprecated(func):
25+
def deprecated_func(*args, **kwargs):
26+
warnings.warn("{} retired in October 2017. To continue using document conversion capabilities, please use Watson Discovery.".format(func.__name__),
27+
category=DeprecationWarning,
28+
stacklevel=2)
29+
warnings.simplefilter('default', DeprecationWarning)
30+
return func(*args, **kwargs)
31+
return deprecated_func
2332

2433
class DocumentConversionV1(WatsonService):
2534
DEFAULT_URL = 'https://gateway.watsonplatform.net/document-conversion/api'
@@ -28,10 +37,12 @@ class DocumentConversionV1(WatsonService):
2837
NORMALIZED_TEXT = 'normalized_text'
2938
latest_version = '2016-02-10'
3039

40+
@deprecated
3141
def __init__(self, version, url=DEFAULT_URL, **kwargs):
3242
WatsonService.__init__(self, 'document_conversion', url, **kwargs)
3343
self.version = version
3444

45+
@deprecated
3546
def convert_document(self, document, config, media_type=None):
3647
params = {'version': self.version}
3748
filename = os.path.basename(document.name)
@@ -45,7 +56,7 @@ def convert_document(self, document, config, media_type=None):
4556
return self.request(method='POST', url='/v1/convert_document',
4657
files=files, params=params,
4758
accept_json=accept_json)
48-
59+
@deprecated
4960
def index_document(self, config, document=None, metadata=None,
5061
media_type=None):
5162
if document is None and metadata is None:

0 commit comments

Comments
 (0)