File tree 2 files changed +11
-2
lines changed 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 87
87
"requests>=2.16.0,<3.0.0" ,
88
88
# remove typing_extensions after python_requires>=3.8, see web3._utils.compat
89
89
"typing-extensions>=3.7.4.1,<4;python_version<'3.8'" ,
90
- "websockets>=9.1,<10 " ,
90
+ "websockets>=9.1,<=10.0 " ,
91
91
],
92
92
python_requires = '>=3.6,<4' ,
93
93
extras_require = extras_require ,
Original file line number Diff line number Diff line change 2
2
import json
3
3
import logging
4
4
import os
5
+ import sys
5
6
from threading import (
6
7
Thread ,
7
8
)
10
11
)
11
12
from typing import (
12
13
Any ,
14
+ Dict ,
13
15
Optional ,
14
16
Type ,
15
17
Union ,
40
42
DEFAULT_WEBSOCKET_TIMEOUT = 10
41
43
42
44
45
+ def _loop_if_py_lt_38 (loop : asyncio .AbstractEventLoop ) -> Dict [str , Any ]:
46
+ """
47
+ Helper for the removal of the loop argument in Python 3.10.
48
+ """
49
+ return {"loop" : loop } if sys .version_info [:2 ] < (3 , 8 ) else {}
50
+
51
+
43
52
def _start_event_loop (loop : asyncio .AbstractEventLoop ) -> None :
44
53
asyncio .set_event_loop (loop )
45
54
loop .run_forever ()
@@ -70,7 +79,7 @@ def __init__(
70
79
async def __aenter__ (self ) -> WebSocketClientProtocol :
71
80
if self .ws is None :
72
81
self .ws = await connect (
73
- uri = self .endpoint_uri , loop = self .loop , ** self .websocket_kwargs
82
+ uri = self .endpoint_uri , ** _loop_if_py_lt_38 ( self .loop ) , ** self .websocket_kwargs
74
83
)
75
84
return self .ws
76
85
You can’t perform that action at this time.
0 commit comments