Skip to content

Commit fb3a89f

Browse files
authored
Merge pull request #14 from haodeqi/authentication
chore: update authentication method and requirements
2 parents 10709a3 + 020222a commit fb3a89f

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Semantic versioning
22
# MAJOR.MINOR.PATCH
33

4-
__version__ = '1.0.0'
4+
__version__ = '1.0.1'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.0.1'

assistant_dialog_skill_analysis/utils/skills_util.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from nbconvert.preprocessors import ExecutePreprocessor
1111
import nltk
1212
import ibm_watson
13+
from ibm_cloud_sdk_core.authenticators import \
14+
IAMAuthenticator, BasicAuthenticator, NoAuthAuthenticator
1315

1416
DEFAULT_API_VERSION = '2019-02-28'
1517
DEFAULT_PROD_URL = 'https://gateway.watsonplatform.net/assistant/api'
@@ -113,30 +115,15 @@ def retrieve_workspace(iam_apikey=None,
113115
:param export_flag:
114116
:return workspace: workspace json
115117
"""
116-
conversation = None
117118

118119
if iam_apikey:
119-
if url == "https://gateway-s.watsonplatform.net/assistant/api":
120-
conversation = ibm_watson.AssistantV1(iam_apikey=iam_apikey,
121-
url=url,
122-
iam_url=STAGE_IAM_URL,
123-
version=api_version)
124-
else:
125-
conversation = ibm_watson.AssistantV1(iam_apikey=iam_apikey,
126-
url=url,
127-
version=api_version)
120+
authenticator = IAMAuthenticator(apikey=iam_apikey)
128121
elif username and password:
129-
if url == "https://gateway-s.watsonplatform.net/assistant/api":
130-
conversation = ibm_watson.AssistantV1(username=username,
131-
password=password,
132-
url=url,
133-
iam_url=STAGE_IAM_URL,
134-
version=api_version)
135-
else:
136-
conversation = ibm_watson.AssistantV1(username=username,
137-
password=password,
138-
url=url,
139-
version=api_version)
122+
authenticator = BasicAuthenticator(username=username, password=password)
123+
else:
124+
authenticator = NoAuthAuthenticator()
125+
126+
conversation = ibm_watson.AssistantV1(authenticator=authenticator, version=api_version)
140127

141128
if export_flag:
142129
ws_json = conversation.get_workspace(workspace_id, export=export_flag)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ tabulate
55
matplotlib
66
nltk
77
seaborn
8-
ibm-watson>=3.2.0
8+
ibm-watson==4.0.1
99
scipy>=1.2.0
1010
jupyter

0 commit comments

Comments
 (0)