Django的Chatwork集成
django-chatwork的Python项目详细描述
django chatwork是django的chatwork集成。
要求
- python>;=3.5
- django>;=1.11
快速启动
通过pip安装
# instal from PyPI pip install django-chatwork # install from github master branch pip install -U https://github.com/kacchan822/django-chatwork/archive/master.tar.gz
将“聊天室”添加到已安装的应用程序中
INSTALLED_APPS = [ ... 'chatwork', ... ]
在“设置”中设置值
# You have to set this CHATWORK_API_TOKEN = 'youre api token' # You don't have to usually set this CHATWORK_API_ENDPOINT_BASE = 'https://api.chatwork.com/v2' # default CHATWORK_API_BACKEND = 'chatwork.backends.http.UrllibBackend' # default if DEBUG = False # if DEBUG = True, the value set 'chatwork.backends.dummy.DummyBackend' as default CHATWORK_API_FAIL_SILENTLY = None # default
用法
from chatwork import send_message ... # send message to room_id = 123456 send_chatwork('message text hear', 123456) # send message to room_id = 123456 with [To:] for all members send_chatwork('message text hear', 123456, to_all=True) # send message to room_id = 123456 with INFO format # INFO format contains [To:] for all users send_chatwork('message text hear', 123456, title='info title') ...