【文件属性】:
文件名称:pubsub:带有Twisted的Python中的简单PubSub服务器实现
文件大小:7KB
文件格式:ZIP
更新时间:2021-05-14 12:29:46
Python
pubsub
Python中的简单PubSub服务器实现。 使用Twisted < >构建。
安装
在virtualenv中,运行python setup.py install 。
用法示例
使用pubsubserve运行PubSub服务器(默认情况下,该服务器侦听localhost:3000 )。
在交互式会话中(我正在使用IPython):
In [1]: from pubsub import PubSub
In [2]: def test(**kwargs):
...: print("HELLO %s" % kwargs)
...:
In [3]: ps = PubSub()
In [4]: ps.subscribe("hello", test)
In [5]: ps.run()
等待时,在另一个交互式会话中:
In [1]: from pubsub i
【文件预览】:
pubsub-master
----setup.py(885B)
----.gitignore(315B)
----requirements.txt(16B)
----MANIFEST.in(239B)
----LICENSE(1KB)
----README.rst(914B)
----tests()
--------test_net.py(3KB)
--------test_local.py(573B)
----pubsub()
--------local.py(979B)
--------__init__.py(170B)
--------net.py(5KB)
----tox.ini(115B)