While the document suggests that the logging can be disabled by the below command NaturalLanguageUnderstandingV1( username='abcd', password='abcd', version='2017-02-27', x_watson_learning_opt_out=True)
This doesn't seem to work for me in Python. I get the below error message. TypeError: init() got an unexpected keyword argument 'x_watson_learning_opt_out'
Is there a workaround to this ?
What version of the watson-developer-cloud sdk for Python are you using?
watson_developer_cloud.version Out[10]: '1.0.2'
Answer by @chughts (12979) | Jan 09, 2018 at 08:53 AM
I think that there is a bug in the Python SDK post 1.0.0, that doesn't pass the x_watson_learning_opt_out
parameter up the class hierarchy. The superclass WatsonService (https://github.com/watson-developer-cloud/python-sdk/blob/master/watson_developer_cloud/watson_service.py), defaults it to False
, but the NaturalLanguageUnderstandingV1 class (https://github.com/watson-developer-cloud/python-sdk/blob/master/watson_developer_cloud/natural_language_understanding_v1.py) ignores what you pass it, and doesn't send it to the superclass init constructor.
I have raised a new issue against the SDK - https://github.com/watson-developer-cloud/python-sdk/issues/344
As per the response to the issue against the github repo. This is a post 1.0.0 SDK change, and the bug is actually in the documentation.
The way to set the opt out has changed and is now done post constructor by setting the headers -
nlu = NaturalLanguageUnderstandingV1(username = user_name, password = password, version = version)
nlu.set_default_headers({'x-watson-learning-opt-out': "true"})