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
193193
194194 asyncio.run(client.connect(handle_msg))
195195
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 :
22
3- WebSockets
3+ WebSocket
44==========
55
66===========
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
99
1010 Getting-Started
1111 Aggs
12- WebSockets
12+ WebSocket
1313 Snapshot
1414 Quotes
1515 Reference
1616 Trades
1717 vX
1818 Models
1919 Enums
20-
20+ WebSocket-Enums
2121
2222Indices and tables
2323==================
Original file line number Diff line number Diff line change 11from .rest import RESTClient
2- from .websocket import WebSocketClient
2+ from .websocket import WebSocketClient , AuthError
Original file line number Diff line number Diff line change 1313env_key = "POLYGON_API_KEY"
1414
1515
16+ class AuthError (Exception ):
17+ pass
18+
19+
1620class WebSocketClient :
1721 def __init__ (
1822 self ,
@@ -71,6 +75,7 @@ async def connect(
7175
7276 :param processor: The callback to process messages.
7377 :param close_timeout: How long to wait for handshake when calling .close.
78+ :raises AuthError: If invalid API key is supplied.
7479 """
7580 reconnects = 0
7681 isasync = inspect .iscoroutinefunction (processor )
@@ -98,8 +103,7 @@ async def connect(
98103 if self .verbose :
99104 print ("authed:" , auth_msg )
100105 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" ])
103107 while True :
104108 if self .schedule_resub :
105109 if self .verbose :
You can’t perform that action at this time.
0 commit comments