【问题标题】:Watson Discovery service create_collection() api call returns Error 415: Unsupported Media TypeWatson Discovery 服务 create_collection() api 调用返回错误 415:不支持的媒体类型
【发布时间】:2017-06-23 06:35:14
【问题描述】:

我正在使用DiscoveryV1 python 库尝试在我的 WDS 环境中创建一个新集合。我有以下代码:

from watson_developer_cloud import DiscoveryV1

discovery = DiscoveryV1(
username = "username goes here",
password = "password goes here",
version = "version goes here")

conf_id ='valid configuration_id'
env_id = 'valid environment_id'
new_col = discovery.create_collection(env_id, 'TestV2', configuration_id=conf_id)

上述块的最后一行抛出以下错误: watson_developer_cloud.watson_developer_cloud_service.WatsonException: Error: Unsupported Media Type, Code: 415

完整的堆栈跟踪:

Traceback (most recent call last):
  File "uploadCorpus.py", line 23, in <module>
    new_col = discovery.create_collection(env_id, 'TestV2', configuration_id=conf_id)
  File "/home/Vito.Colano/Apps/anaconda2/lib/python2.7/site-packages/watson_developer_cloud/discovery_v1.py", line 227, in create_collection
    accept_json=True)
  File "/home/Vito.Colano/Apps/anaconda2/lib/python2.7/site-packages/watson_developer_cloud/watson_developer_cloud_service.py", line 324, in request
    raise WatsonException(error_message)
watson_developer_cloud.watson_developer_cloud_service.WatsonException: 
Error: Unsupported Media Type, Code: 41

【问题讨论】:

    标签: python watson-discovery


    【解决方案1】:

    这似乎是 Python SDK for Discovery 中的一个错误。我刚才打开了一个拉取请求来修复它。 https://github.com/watson-developer-cloud/python-sdk/pull/223

    我忘了说谢谢你问这个问题。由于您的问题,我只是去寻找这个错误并弄清楚要修复什么。

    【讨论】:

    • 非常感谢,布鲁斯。
    猜你喜欢
    • 2014-09-15
    • 2013-05-27
    • 1970-01-01
    • 2021-04-27
    • 2016-11-26
    • 1970-01-01
    • 2018-10-13
    • 2018-07-25
    • 2016-09-09
    相关资源
    最近更新 更多