watson-developer-cloud/personality-insights-python モジュールを bluemix にデプロイし、Bluemix で APP を作成しました。アプリのリンクは問題なく動作しています。ただし、/v2/profile api を呼び出したい場合、ポスト リクエストでエラーが発生します。Pythonで使用したコードは次のとおりです。
import requests, json
payload = {'id': 'my-id',
'userid': 'id-here',
'sourceid' : 'twitter',
'contenttype' : 'text/plain',
'language' : 'en',
'content' : 'text to analyse goes here'
}
input_data=json.dumps(payload);
r = requests.post("http://MY-APP.mybluemix.net/v2",
auth=("USERNAME", "PASSWORD"),
headers = {"content-type": "application/json"},
data=input_data)
print(r.content)
このエラーが発生し続けます。
b'{"help": "http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/personality-insights/#overviewInput", "error": "The number of words 1 is less than the minimum number of words required for analysis: 100", "code": 400}'
V2 を使用せずに URL を変更すると、このエラーが発生します
b'{"code": 400, "error": "No text provided"}'