1 parent 52b9319 commit d31a696Copy full SHA for d31a696
1 file changed
pyrogram/client/types/pyrogram_type.py
@@ -43,5 +43,9 @@ def remove_none(obj):
43
44
class Encoder(JSONEncoder):
45
def default(self, o: PyrogramType):
46
- content = {i: getattr(o, i) for i in filter(lambda x: not x.startswith("_"), o.__dict__)}
+ try:
47
+ content = {i: getattr(o, i) for i in filter(lambda x: not x.startswith("_"), o.__dict__)}
48
+ except AttributeError:
49
+ return repr(o)
50
+
51
return remove_none(OrderedDict([("_", "pyrogram:" + o.__class__.__name__)] + [i for i in content.items()]))
0 commit comments