IBM / build-knowledge-base-with-domain-specific-documents

Create a knowledge base using domain specific documents and the mammoth python library
https://developer.ibm.com/patterns/build-a-domain-specific-knowledge-graph-from-given-set-of-documents/
Apache License 2.0
131 stars 43 forks source link

unable to run on IBM watson #15

Open lihuiliullh opened 4 years ago

lihuiliullh commented 4 years ago

I run the code on IBM watson jupyter, but still couldn't get the result.

image


ValueError Traceback (most recent call last)

in 4 ibm_auth_endpoint=credentials_1['IBM_AUTH_ENDPOINT'], 5 config=Config(signature_version='oauth'), ----> 6 endpoint_url=credentials_1['ENDPOINT']) 7 8 def get_file(filename): /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_boto3/__init__.py in client(*args, **kwargs) 92 See :py:meth:`ibm_boto3.session.Session.client`. 93 """ ---> 94 return _get_default_session().client(*args, **kwargs) 95 96 /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_boto3/session.py in client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, ibm_api_key_id, ibm_service_instance_id, ibm_auth_endpoint, auth_function, token_manager, config) 322 ibm_api_key_id=ibm_api_key_id, ibm_service_instance_id=ibm_service_instance_id, 323 ibm_auth_endpoint=ibm_auth_endpoint, auth_function=auth_function, --> 324 token_manager=token_manager, config=config) 325 326 def resource(self, service_name, region_name=None, api_version=None, /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_botocore/session.py in create_client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, ibm_api_key_id, ibm_service_instance_id, ibm_auth_endpoint, auth_function, token_manager, config) 898 is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify, 899 credentials=credentials, scoped_config=self.get_scoped_config(), --> 900 client_config=config, api_version=api_version) 901 monitor = self._get_internal_component('monitor') 902 if monitor is not None: /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_botocore/client.py in create_client(self, service_name, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, api_version, client_config) 84 client_args = self._get_client_args( 85 service_model, region_name, is_secure, endpoint_url, ---> 86 verify, credentials, scoped_config, client_config, endpoint_bridge) 87 service_client = cls(**client_args) 88 self._register_retries(service_client) /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_botocore/client.py in _get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge) 326 return args_creator.get_client_args( 327 service_model, region_name, is_secure, endpoint_url, --> 328 verify, credentials, scoped_config, client_config, endpoint_bridge) 329 330 def _create_methods(self, service_model): /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_botocore/args.py in get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge) 83 timeout=(new_config.connect_timeout, new_config.read_timeout), 84 socket_options=socket_options, ---> 85 client_cert=new_config.client_cert) 86 87 serializer = ibm_botocore.serialize.create_serializer( /opt/conda/envs/Python36/lib/python3.6/site-packages/ibm_botocore/endpoint.py in create_endpoint(self, service_model, region_name, endpoint_url, verify, response_parser_factory, timeout, max_pool_connections, http_session_cls, proxies, socket_options, client_cert) 259 if not is_valid_endpoint_url(endpoint_url): 260 --> 261 raise ValueError("Invalid endpoint: %s" % endpoint_url) 262 if proxies is None: 263 proxies = self._get_proxies(endpoint_url) ValueError: Invalid endpoint:
ghost commented 4 years ago

IBM cloud services recently changed the way the handle credentials. I ran the notebook locally by using the "service credentials" of the Natural Language Understanding Service. It will look like this: natural_language_understanding = NaturalLanguageUnderstandingV1( username= 'apikey', password='DZ7Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', url = "https://gateway-lon.watsonplatform.net/natural-language-understanding/api", version='2017-02-27')