Client library for docomo API written in Python.
Python
Permalink
Failed to load latest commit information.
doco Delete unuse function. Nov 23, 2015
examples Fix for python example/dialogue_cli.py not work. Aug 19, 2015
tests Bump up version. Feb 26, 2015
.gitignore First commit. Dec 18, 2014
.travis.yml Drop py33 add py35. Nov 23, 2015
LICENSE First commit. Dec 18, 2014
MANIFEST.in First commit. Dec 18, 2014
README.rst Fix docs. Dec 21, 2014
requirements.txt First commit. Dec 18, 2014
setup.py Bump up version. Feb 26, 2015
tox.ini Fix pep8 to pycodestyle. Jun 17, 2016

README.rst

doco

https://travis-ci.org/heavenshell/py-doco.svg?branch=master

Client library for docomo API written in Python.

https://dev.smt.docomo.ne.jp/?p=docs.index

Supported apis

  • Dialogue

Sample code

>>> from doco.client import Client
>>> c = Client(apikey='YOUR_API_KEY')
>>> res = c.send(utt='hello', apiname='Dialogue')
>>> print(res)
{"utt":"はろー","yomi":"はろー","mode":"dialog","da":"30","context":"7DGIKMpQDE0zrQrYFAMqdw"}
>>> print(c.last_response.status_code)
200
>>> print(c.last_response.headers)
{'Content-Length': '99', 'Connection': 'keep-alive', 'Content-Type': 'application/json;charset=UTF-8', 'Date': 'Wed, 17 Dec 2014 05:28:28 GMT', 'asyncServiceInvoke': 'false'}

Cli example

$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -u こんにちは
'mode': 'dialog', 'utt': 'どうも', 'context': 'N1liohyhkp6K7M80KS3bwg', 'da': '0', 'yomi': 'どうも'}

Interactive shell mode

$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -i
Welcome to docomo dialogue cli.
^D to exit.
>>> こんにちは
はろー
>>>

Shiritori mode

$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -i -s
Welcome to docomo dialogue cli.
^D to exit.
>>> しりとり
リング
>>> グッズ
頭痛
>>> 海
道のり
>>> リンゴ
ゴリラ
>>> ラッパ
パスポート
>>>