TCP framework in flavor of Netty
Project description
py-netty :rocket:
An epoll-based TCP networking library for Python 3.7+.
APIs are similar to the Netty framework.
Installation
python -m pip install py-netty
Getting Started
Start an echo server:
from py_netty import ServerBootstrap
ServerBootstrap().bind(address='0.0.0.0', port=8080).close_future().sync()
As TCP client:
from py_netty import Bootstrap
from py_netty.handler import NoOpChannelHandler
class HttpHandler(NoOpChannelHandler):
def channel_read(self, ctx, buffer):
print(buffer.decode('utf-8'))
remote_address, remote_port = 'www.google.com', 80
b = Bootstrap(handler=HttpHandler())
channel = b.connect(remote_address, remote_port).sync().channel()
request = f'GET / HTTP/1.1\r\nHost: {remote_address}\r\n\r\n'
channel.write(request.encode('utf-8'))
channel.close()
Performance Test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-netty-0.0.4.tar.gz
(10.7 kB
view hashes)
Built Distribution
py_netty-0.0.4-py3-none-any.whl
(11.6 kB
view hashes)