gpt4 book ai didi

python - 沃森发现 "Access is denied due to invalid credentials"- Python

转载 作者:太空宇宙 更新时间:2023-11-04 02:41:57 25 4
gpt4 key购买 nike

我想使用 IBM Watson Discovery Services,但在尝试时收到一条错误消息。错误消息是:WatsonException: Unauthorized: Access is denied due to invalid credentials

import sys  
import os
import json
from watson_developer_cloud import DiscoveryV1

discovery = DiscoveryV1(
username="{bbbaaaaa}",
password="{aaaaaabbbb}",
version="2017-09-01"
)

qopts = {'query': 'enriched_text.entities.text:IBM'}
my_query = discovery.query('system', 'news', qopts)
print(json.dumps(my_query, indent=2))

最佳答案

从您的用户名和密码中删除 {}

现在应该是

discovery = DiscoveryV1(  
username="aaaaabbbbbb",
password="bbbbbaaaaa",
version="2017-09-01"
)

关于python - 沃森发现 "Access is denied due to invalid credentials"- Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46227517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com