File tree Expand file tree Collapse file tree 6 files changed +38
-7
lines changed Expand file tree Collapse file tree 6 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -193,3 +193,5 @@ Websocket client usage
193
193
194
194
asyncio.run(client.connect(handle_msg))
195
195
196
+ .. note ::
197
+ Raises :code: `AuthError ` if invalid API key is provided.
Original file line number Diff line number Diff line change
1
+ .. _websocket_enums_header :
2
+
3
+ WebSocket Enums
4
+ ==============================
5
+
6
+ ==============================================================
7
+ Feed
8
+ ==============================================================
9
+ .. autoclass :: polygon.websocket.models.Feed
10
+ :members:
11
+ :undoc-members:
12
+
13
+ ==============================================================
14
+ Market
15
+ ==============================================================
16
+ .. autoclass :: polygon.websocket.models.Market
17
+ :members:
18
+ :undoc-members:
19
+
20
+ ==============================================================
21
+ EventType
22
+ ==============================================================
23
+ .. autoclass :: polygon.websocket.models.EventType
24
+ :members:
25
+ :undoc-members:
Original file line number Diff line number Diff line change 1
- .. _ websockets_header :
1
+ .. _ websocket_header :
2
2
3
- WebSockets
3
+ WebSocket
4
4
==========
5
5
6
6
===========
Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ This documentation is for the Python client only. For details about the response
9
9
10
10
Getting-Started
11
11
Aggs
12
- WebSockets
12
+ WebSocket
13
13
Snapshot
14
14
Quotes
15
15
Reference
16
16
Trades
17
17
vX
18
18
Models
19
19
Enums
20
-
20
+ WebSocket-Enums
21
21
22
22
Indices and tables
23
23
==================
Original file line number Diff line number Diff line change 1
1
from .rest import RESTClient
2
- from .websocket import WebSocketClient
2
+ from .websocket import WebSocketClient , AuthError
Original file line number Diff line number Diff line change 13
13
env_key = "POLYGON_API_KEY"
14
14
15
15
16
+ class AuthError (Exception ):
17
+ pass
18
+
19
+
16
20
class WebSocketClient :
17
21
def __init__ (
18
22
self ,
@@ -71,6 +75,7 @@ async def connect(
71
75
72
76
:param processor: The callback to process messages.
73
77
:param close_timeout: How long to wait for handshake when calling .close.
78
+ :raises AuthError: If invalid API key is supplied.
74
79
"""
75
80
reconnects = 0
76
81
isasync = inspect .iscoroutinefunction (processor )
@@ -98,8 +103,7 @@ async def connect(
98
103
if self .verbose :
99
104
print ("authed:" , auth_msg )
100
105
if auth_msg_parsed [0 ]["status" ] == "auth_failed" :
101
- print (auth_msg_parsed [0 ]["message" ])
102
- return
106
+ raise AuthError (auth_msg_parsed [0 ]["message" ])
103
107
while True :
104
108
if self .schedule_resub :
105
109
if self .verbose :
You can’t perform that action at this time.
0 commit comments