WatsonApiException: Error: The Preview API was removed on 2019-09-30

WatsonApiException: Error: The Preview API was removed on 2019-09-30

我正在尝试使用以下代码访问 IBM Watson Discovery API(免费试用):

with open(filename, "r") as f:
    res = discovery.test_configuration_in_environment(environment_id=env_id, configuration_id=cfg_id, file=f).get_result()

您可以在此处查看完整的代码文件:https://github.com/udacity/AIND-NLP-Bookworm/blob/master/bookworm.ipynb。我在 运行 上收到以下错误:

---------------------------------------------------------------------------
WatsonApiException                        Traceback (most recent call last)
<ipython-input-10-17e98c795a32> in <module>()
      3 filename = os.path.join(data_dir, "sample.html")
      4 with open(filename, "r") as f:
----> 5     res = discovery.test_configuration_in_environment(environment_id=env_id, configuration_id=cfg_id, file=f).get_result()
      6 print(json.dumps(res, indent=2))

/opt/conda/lib/python3.6/site-packages/watson_developer_cloud/discovery_v1.py in test_configuration_in_environment(self, environment_id, configuration, step, configuration_id, file, metadata, file_content_type, filename, **kwargs)
    702             params=params,
    703             files=form_data,
--> 704             accept_json=True)
    705         return response
    706 

/opt/conda/lib/python3.6/site-packages/watson_developer_cloud/watson_service.py in request(self, method, url, accept_json, headers, params, json, data, files, **kwargs)
    585             error_info = self._get_error_info(response)
    586             raise WatsonApiException(response.status_code, error_message,
--> 587                                      info=error_info, httpResponse=response)

WatsonApiException: Error: The Preview API was removed on 2019-09-30., Code: 410 , X-dp-watson-tran-id: 569fbd407a75c23f850522571bddee26 , X-global-transaction-id: 569fbd407a75c23f850522571bddee26

任何已知的解决方法?

根据发行说明和您看到的回复,Preview API 已于 2019 年 6 月 4 日弃用 - https://cloud.ibm.com/docs/discovery?topic=discovery-release-notes#4jun19 - and removed on the 30 Sept 2019 - https://cloud.ibm.com/docs/discovery?topic=discovery-release-notes

Discovery API 仍然可用 - https://cloud.ibm.com/apidocs/discovery/discovery ,只是不是预览方法。

你想做什么?