From 2ebb295be1f1ccaa878365d68474df8fcd1c79da Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Tue, 16 Jan 2024 00:33:05 -0500 Subject: [PATCH] handle TypeError in Message.object_id --- relay/misc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/relay/misc.py b/relay/misc.py index 9325b40..7244eaa 100644 --- a/relay/misc.py +++ b/relay/misc.py @@ -251,6 +251,16 @@ class Message(ApMessage): }) + # todo: remove when fixed in aputils + @property + def object_id(self) -> str: + try: + return self["object"]["id"] + + except (KeyError, TypeError): + return self["object"] + + class Response(AiohttpResponse): @classmethod def new(cls: Type[Response],