mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Adds serialize method
After adding the triggered flag we can not just use to_json to serialize since the two data blobs won't match. This also sets ground towards having a generalized serialization function.
This commit is contained in:
@@ -48,3 +48,8 @@ class Appointment:
|
||||
|
||||
def to_json(self):
|
||||
return json.dumps(self.to_dict(), sort_keys=True, separators=(',', ':'))
|
||||
|
||||
def serialize(self):
|
||||
data = self.to_dict()
|
||||
data.pop("triggered")
|
||||
return json.dumps(data, sort_keys=True, separators=(',', ':')).encode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user