1616The v1 Document Conversion service
1717(https://www.ibm.com/watson/developercloud/document-conversion.html)
1818"""
19+ import warnings
1920from .watson_service import WatsonService
2021import os
2122import 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
2433class 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