https://github.com/heavenshell/py-doco
Client library for docomo API written in Python.
https://github.com/heavenshell/py-doco
Last synced: about 1 year ago
JSON representation
Client library for docomo API written in Python.
- Host: GitHub
- URL: https://github.com/heavenshell/py-doco
- Owner: heavenshell
- License: bsd-3-clause
- Created: 2014-12-18T14:05:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-05-23T02:03:43.000Z (about 3 years ago)
- Last Synced: 2024-04-20T14:28:37.451Z (about 2 years ago)
- Language: Python
- Size: 45.9 KB
- Stars: 10
- Watchers: 6
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
doco
====
.. image:: https://github.com/heavenshell/py-doco/workflows/build/badge.svg
:target: https://github.com/heavenshell/py-doco/actions
Client library for docomo API written in Python.
https://dev.smt.docomo.ne.jp/?p=docs.index
Supported apis
--------------
- Dialogue
Sample code
-----------
.. code:: python
>>> 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
-----------
.. code:: python
$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -u こんにちは
'mode': 'dialog', 'utt': 'どうも', 'context': 'N1liohyhkp6K7M80KS3bwg', 'da': '0', 'yomi': 'どうも'}
Interactive shell mode
~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -i
Welcome to docomo dialogue cli.
^D to exit.
>>> こんにちは
はろー
>>>
Shiritori mode
~~~~~~~~~~~~~~
.. code:: python
$ export DOCO_API_KEY="YOUR API KEY"
$ python examples/dialogue_cli.py -i -s
Welcome to docomo dialogue cli.
^D to exit.
>>> しりとり
リング
>>> グッズ
頭痛
>>> 海
道のり
>>> リンゴ
ゴリラ
>>> ラッパ
パスポート
>>>