From c0552d9d644a1dfa1e2111b1afe78fadc55af045 Mon Sep 17 00:00:00 2001 From: Mickey Yawn Date: Mon, 20 Nov 2023 09:48:51 -0500 Subject: [PATCH] removed old method. oops. removed old method. oops. --- polygon/websocket/__init__.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/polygon/websocket/__init__.py b/polygon/websocket/__init__.py index 4875a1ac..c86d0d7d 100644 --- a/polygon/websocket/__init__.py +++ b/polygon/websocket/__init__.py @@ -197,15 +197,26 @@ async def _unsubscribe(self, topics: Union[List[str], Set[str]]): self.json.dumps({"action": "unsubscribe", "params": subs}) ) + @staticmethod def _parse_subscription(s: str): s = s.strip() split = s.split(".") - if len(split) != 2: - logger.warning("invalid subscription:", s) - return [None, None] + length = len(split) + + match length: + case _ if length < 2: + logger.warning("invalid subscription:", s) + return [None, None] + case 3: + return split[0], split[1] + "." + split[2] + case _ if length > 3: + logger.warning("invalid subscription:", s) + return [None, None] + case _: + return split[0], split[1] + - return split def subscribe(self, *subscriptions: str): """