当从IBM-cloud python SDK的2.10.4版本更改到新的3.0.4版本时,我不能再使用set_detailed_response(False)
使用watson python SDK利用IBM_watson助手、文本到语音、语音到文本和视觉识别服务。当SDK更新到2.0版本时,所有方法的默认响应都更改为DetailedResponse (https://pypi.org/project/ibm-watson/#changes-for-v20)。这个DetailedResponse的一个问题是它是不可迭代的,这对于我的情况是必要的。幸运的是,SDK提供了一种使用set_detailed_response(False) (https://pypi.org/project/ibm-watson/#parsing-http-response-info)来改变这一点的方法。
e.g
from ibm_watson import VisualRecognitionV3
visualrecognition = VisualRecognitionV3(
username='xxx',
password='yyy',
url='<url_as_per_region>',
version='version',
iam_apikey='apikey')
visualrecognition.set_detailed_response(False)但是自从更新到3.0.4版本后,我得到了以下错误:
AttributeError:“”VisualRecognitionV3“”对象没有属性“”set_detailed_response“”
发布于 2019-06-26 19:42:32
为了具有旧的行为,即只获取常规响应,changelog section you are referencing建议将get_result()应用于响应。
print(response.get_result())我还没有在VR上测试过它,但它可以与我的Watson Assistant和Discovery服务一起使用。
https://stackoverflow.com/questions/56771515
复制相似问题