From 41ff375f08f52ab43f2f7bd90c60b7311533785e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 13 Apr 2018 20:56:12 +0200 Subject: [PATCH] Allow accessing Object fields using square brackets --- pyrogram/api/core/object.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/api/core/object.py b/pyrogram/api/core/object.py index bec9d015..0340e3ea 100644 --- a/pyrogram/api/core/object.py +++ b/pyrogram/api/core/object.py @@ -46,6 +46,9 @@ class Object: def __call__(self): pass + def __getitem__(self, item): + return getattr(self, item) + class Encoder(JSONEncoder): def default(self, o: Object):