watson-developer-cloud/python-sdk

AttributeError: 'DiscoveryV2' object has no attribute 'list_documents'

giacomobartoli opened this issue · 1 comments

This snippet of code is returning an error. Params are correct. Double checked.

from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator


authenticator = IAMAuthenticator('my-apikey')
discovery = DiscoveryV2(
    version='2020-08-30',
    authenticator=authenticator
)
discovery.set_service_url('https://api.eu-de.discovery.watson.cloud.ibm.com')
details = discovery.list_documents('WDS_PROJECT_ID', 'WDS_COLLECTION_ID).get_result()

SDK Version
AttributeError: 'DiscoveryV2' object has no attribute 'list_documents'

SDK Version
Version: 5.2.3
Summary: Client library to use the IBM Watson Services
Home-page: https://github.com/watson-developer-cloud/python-sdk
Author: IBM Watson
Author-email: watdevex@us.ibm.com
License: Apache 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: ibm-cloud-sdk-core, python-dateutil, requests, websocket-client

Additional information:

  • OS: iOS
  • Python 3.7.8
  • Running on VSC

Additional context
Adapting a custom backend from Watson Discovery v1 to Watson Discovery v2.
I a colleague from IBM Consulting, feel free to reach me out on Slack (@giacomino)

Solved. ibm_watson > 7 is needed. Thus:

pip install --upgrade "ibm-watson>=7.0.0"