WebSocket protocol implementation for anyio
Project description
anysocks
This library implements the WebSocket protocol based on the Sans-IO library wsproto. I/O is handled by the anyio project which makes this library compatible to asyncio, trio and curio.
Installation
This library requires Python 3.5+. You can install it directly from PyPI:
python3 -m pip install -U anysocks
If you want the cutting edge development version instead, install it directly from GitHub:
python3 -m pip install -U git+https://github.com/clamor-py/anysocks@master#egg=anysocks
Documentation
This README only provides a short overview, see the full documentation here.
Example
import anyio
from anysocks import open_connection
async def main():
async with open_connection('wss://echo.websocket.org') as con:
print('Connection established!')
# First, let's send some text to the server.
text = input('What to send? ')
await con.send_message(text)
# Now, we receive and verify the server's response.
message = await con.get_message()
assert message == text, "Received {}, expected {}".format(message, text)
print('Connection closed with code {}', con.close_code.value)
anyio.run(main)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anysocks-0.2.2.tar.gz
(19.0 kB
view details)
Built Distribution
anysocks-0.2.2-py3-none-any.whl
(11.9 kB
view details)
File details
Details for the file anysocks-0.2.2.tar.gz
.
File metadata
- Download URL: anysocks-0.2.2.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b0d3442f53c56f0341071ec0cd1f53ff04d35644aad64cd0bc1761dec976b10 |
|
MD5 | 48fe0c5d647848e998ad60e540515348 |
|
BLAKE2b-256 | 4bca57e98ba557998ede5109ae932038d5be21171af365f0d13cd3f5c8ace449 |
File details
Details for the file anysocks-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: anysocks-0.2.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f437456e00d8e9ccd5e486cfc6ddc51931abb2879081677679139302c018456 |
|
MD5 | 0cf1abc804001d9136bee0793b167795 |
|
BLAKE2b-256 | 7c4fff5abecff8a538d88b197a244533ec8eadc18ebf4baf84fc11fbe48bd9b1 |