Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

Set X-Watson-Learning-Opt-Out with Natural Language Classifier - Python

50E6EWBG12 gravatar image
Question by kav28  (0) | Dec 19, 2017 at 08:48 AM watsonpythondocument-conversionnlupython-sdk

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 ?

People who like this

  0   Show 2
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
110000PNBC gravatar image @chughts (12979) ♦   Dec 19, 2017 at 10:15 AM 0
Share

What version of the watson-developer-cloud sdk for Python are you using?

50E6EWBG12 gravatar image kav28 (0) @chughts (12979) ♦   Dec 19, 2017 at 11:54 PM 0
Share

watson_developer_cloud.version Out[10]: '1.0.2'

1 reply

  • Sort: 
110000PNBC gravatar image
Accepted answer

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

Comment

People who like this

  0   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
110000PNBC gravatar image @chughts (12979) ♦   Jan 10, 2018 at 06:39 AM 0
Share

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"})

Follow this question

137 people are following this question.

Answers

Answers & comments

Related questions

Hi there, I am trying to read from a sample pdf file and print json object using document conversion api, but I keep getting the error 400 3 Answers

Set X-Watson-Learning-Opt-Out with Watson Developer Cloud Python SDK 2 Answers

Uploading Document Conversion output to Retrieve and Rank service using python 1 Answer

speech to text client python seems incomplete 2 Answers

Supported Python v2.6 library for IBM Watson Visual Recognition 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges