Packet serialization/deserialization in a Pythonic way.
Project description
päckel
Network protocol library. Handles packet serialization/deserialization in a Pythonic way.
Usage
- Define a basic protocol :
import packel
class Ping(packel.Packet):
text = packel.String()
class Pong(packel.Packet):
is_hello = packel.Boolean()
protocol = packel.Protocol([Ping, Pong])
- Use it to serialize and deserialize data :
request = Ping(text='hello')
serialized_bytes = protocol.serialize(request)
# ...
packet = protocol.deserialize(serialized_bytes)
if isinstance(packet, Ping):
is_hello = packet.text == 'hello'
response = Pong(is_hello=is_hello)
# ...
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
packel-1.0.0.tar.gz
(2.8 kB
view hashes)
Built Distribution
packel-1.0.0-py3-none-any.whl
(3.7 kB
view hashes)