Skip to content
Packet serialization/deserialization in a Pythonic way.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
packel
.gitignore
README.md
UNLICENSE
setup.py
test_protocol.py

README.md

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)
    # ...
You can’t perform that action at this time.