examples(compare comply): Update compare comply examples
@@ -3,20 +3,14 @@ from __future__ import print_function
import json
import os
from ibm_watson import CompareComplyV1
+from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
-# If service instance provides API key authentication
+authenticator = IAMAuthenticator('your apikey')
compare_comply = CompareComplyV1(
version='2018-03-23',
## url is optional, and defaults to the URL below. Use the correct URL for your region.
url='https://gateway.watsonplatform.net/compare-comply/api',
- iam_apikey='YOUR APIKEY')
-
-# compare_comply = CompareComplyV1(
-# version='2018-03-23',
-# ## url is optional, and defaults to the URL below. Use the correct URL for your region.
-# # url='https://gateway.watsonplatform.net/compare-comply/api',
-# username='YOUR SERVICE USERNAME',
-# password='YOUR SERVICE PASSWORD')
+ authenticator=authenticator)
print('Convert to HTML')
contract = os.path.abspath('resources/contract_A.pdf')
@@ -27,7 +21,7 @@ with open(contract, 'rb') as file:
print('Classify elements')
contract = os.path.abspath('resources/contract_A.pdf')
with open(contract, 'rb') as file:
- result = compare_comply.classify_elements(file, 'application/pdf').get_result()
+ result = compare_comply.classify_elements(file, file_content_type='application/pdf').get_result()
print(json.dumps(result, indent=2))
print('Extract tables')
