anyio的websocket协议实现

anysocks的Python项目详细描述


任何袜子

这个库基于Sans-IO library wsproto实现the WebSocket protocol。 i/o由anyio project处理,这使得这个库与asyncio、trio和curio兼容。

Build StatusMaintainabilityCodeFactorDocumentation StatusPyPI version

安装

这个库需要Python3.5+。您可以直接从pypi安装它:

python3 -m pip install -U anysocks

如果您希望使用尖端的开发版本,请直接从github安装:

python3 -m pip install -U git+https://github.com/clamor-py/anysocks@master#egg=anysocks

文档

本自述文件仅提供一个简短的概述,请参阅完整的文档here

示例

importanyiofromanysocksimportopen_connectionasyncdefmain():asyncwithopen_connection('wss://echo.websocket.org')ascon:print('Connection established!')# First, let's send some text to the server.text=input('What to send? ')awaitcon.send(text)# Now, we receive and verify the server's response.message=awaitcon.get_message()assertmessage==text,"Received {}, expected {}".format(message,text)print('Connection closed with code {}',con.close_code.value)anyio.run(main)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在安卓 studio中使用调用jaxws web服务的jar文件   java双时间模拟时钟不打印两个不同的时间   java Jackson反序列化处理不带字段的生成值   多线程在java同步中读锁的目的是什么   为什么java中有这么多获取日期时间的方法?   java从listview中的TextView获取数据   java是否可以定义如何对枚举进行(反)序列化以在枚举内持久化?   Java:异常处理我的catch()有问题   VMWare java SDK:可用的PerfMetricID何时不报告数据?   exec在Java中执行命令而不重定向输出   java使用SpringXML配置实现观察者模式?   java在竹笔平板电脑中使用JPen