mirror of https://github.com/kurisufriend/manager
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
353 B
12 lines
353 B
import json
|
|
class msg:
|
|
def __init__(self, t, b):
|
|
self.type = t
|
|
self.body = b
|
|
def unpack_data(self, data):
|
|
as_str = data.decode("ASCII")
|
|
as_json = json.loads(as_str)
|
|
self.type = as_json["type"]
|
|
self.body = as_json["body"]
|
|
def pack(self):
|
|
return json.dumps(self.__dict__).encode("ASCII") |