访问Soroush Social Network sdk的API
soroush-python-sdk的Python项目详细描述
python的soroush messenger bot包装程序
依赖关系
- Python2.7+
- 请求
- sseclient py
安装
pip install soroush-python-sdk
运行以下命令
git clone https://github.com/soroush-app/bot-python-sdk
cd bot-python-sdk
pip install -r requirements.txt
用法
fromsoroush_python_sdkimportClientbot_token='your bot token'bot=Client(bot_token)try:to='user chat_id'[error,success]=bot.send_text(to,'Your text')ifsuccess:print('Message sent successfully')else:print('Sending message failed: {}'.format(error))exceptExceptionase:print(e.args[0])
上面例子中的“to”值是bot用户的chat\u id。你可以在里面找到它 用户已发送给您的机器人的消息中“from”键的前面。你可以 请参阅examples目录中的更多示例。
##随时欢迎您对本套餐的贡献!- 报告您在issue tracker上发现的任何想法、错误或问题。-你 可以从包的Git repository获取源代码。
历史
0.1.0(2018-10-25)
- pypi上的第一个版本。