Skip to content

Commit 910a874

Browse files
author
clickingbuttons
authored
add auth failed msg (#157)
* add auth failed msg * lint
1 parent 3f0cc8b commit 910a874

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

polygon/websocket/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ async def connect(
9090
if self.verbose:
9191
print("authing:")
9292
await s.send(json.dumps({"action": "auth", "params": self.api_key}))
93-
msg = await s.recv()
93+
auth_msg = await s.recv()
94+
auth_msg_parsed = json.loads(auth_msg)
9495
if self.verbose:
95-
print("authed:", msg)
96+
print("authed:", auth_msg)
97+
if auth_msg_parsed[0]["status"] == "auth_failed":
98+
print(auth_msg_parsed[0]["message"])
99+
return
96100
while True:
97101
if self.schedule_resub:
98102
if self.verbose:

0 commit comments

Comments
 (0)