python绑定tox的skype替换
PyTox的Python项目详细描述
PyTox病毒
用于Project Tox的python绑定。
pytox提供pythonic绑定,即面向对象而不是c风格,引发异常而不是返回错误代码。一个简单的例子如下:
classEchoBot(Tox):defloop(self):whileTrue:self.do()time.sleep(0.03)defon_friend_request(self,pk,message):print'Friend request from %s: %s'%(pk,message)self.add_friend_norequest(pk)print'Accepted.'defon_friend_message(self,friendId,message):name=self.get_name(friendId)print'%s: %s'%(name,message)print'EchoBot: %s'%messageself.send_message(friendId,message)
正如您所看到的,回调被映射到类方法中,而不是使用c方法。有关详细信息,请参阅examples/echo.py。
开始
为了开始,提供了一个makefile在docker容器中运行pytox:
- make test:这将在容器中启动测试。
- make run:这将启动安装了pytox的交互式容器。
- make echobot:这将在容器中启动示例echobot
示例
- echo.py:一个正在工作的回音机器人,它等待朋友的请求,然后开始回音朋友发送的任何内容。
文件
完整的api文档可以阅读here。
待办事项
- 完成API绑定(使用toos/api complete.py进行检查)
- toxav的单位检验
贡献
- 叉开它
- 创建功能分支(git checkout -bmy-new-feature)
- 提交更改(git commit -am 'Add some feature')
- 推到分支(git push origin my-new-feature)
- 创建新的拉取请求