web3 6.20.0__py3-none-any.whl → 6.20.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- web3/_utils/module_testing/module_testing_utils.py +12 -9
- web3/providers/persistent.py +10 -4
- web3/providers/websocket/websocket_v2.py +2 -3
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/METADATA +5 -5
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/RECORD +9 -9
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/WHEEL +1 -1
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/LICENSE +0 -0
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/entry_points.txt +0 -0
- {web3-6.20.0.dist-info → web3-6.20.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
from collections import (
|
|
2
|
-
deque,
|
|
3
|
-
)
|
|
4
1
|
import pytest
|
|
5
2
|
import time
|
|
6
3
|
from typing import (
|
|
@@ -9,6 +6,7 @@ from typing import (
|
|
|
9
6
|
Collection,
|
|
10
7
|
Dict,
|
|
11
8
|
Generator,
|
|
9
|
+
Optional,
|
|
12
10
|
Sequence,
|
|
13
11
|
Union,
|
|
14
12
|
)
|
|
@@ -35,6 +33,7 @@ from web3._utils.compat import (
|
|
|
35
33
|
)
|
|
36
34
|
from web3._utils.request import (
|
|
37
35
|
async_cache_and_return_session,
|
|
36
|
+
asyncio,
|
|
38
37
|
cache_and_return_session,
|
|
39
38
|
)
|
|
40
39
|
from web3.types import (
|
|
@@ -188,9 +187,13 @@ class WebsocketMessageStreamMock:
|
|
|
188
187
|
closed: bool = False
|
|
189
188
|
|
|
190
189
|
def __init__(
|
|
191
|
-
self,
|
|
190
|
+
self,
|
|
191
|
+
messages: Optional[Collection[bytes]] = None,
|
|
192
|
+
raise_exception: Optional[Exception] = None,
|
|
192
193
|
) -> None:
|
|
193
|
-
self.
|
|
194
|
+
self.queue = asyncio.Queue() # type: ignore # py38 issue
|
|
195
|
+
for msg in messages or []:
|
|
196
|
+
self.queue.put_nowait(msg)
|
|
194
197
|
self.raise_exception = raise_exception
|
|
195
198
|
|
|
196
199
|
def __await__(self) -> Generator[Any, Any, "Self"]:
|
|
@@ -203,13 +206,13 @@ class WebsocketMessageStreamMock:
|
|
|
203
206
|
return self
|
|
204
207
|
|
|
205
208
|
async def __anext__(self) -> bytes:
|
|
209
|
+
return await self.recv()
|
|
210
|
+
|
|
211
|
+
async def recv(self) -> bytes:
|
|
206
212
|
if self.raise_exception:
|
|
207
213
|
raise self.raise_exception
|
|
208
214
|
|
|
209
|
-
|
|
210
|
-
raise StopAsyncIteration
|
|
211
|
-
|
|
212
|
-
return self.messages.popleft()
|
|
215
|
+
return await self.queue.get()
|
|
213
216
|
|
|
214
217
|
@staticmethod
|
|
215
218
|
async def pong() -> Literal[False]:
|
web3/providers/persistent.py
CHANGED
|
@@ -9,6 +9,7 @@ from typing import (
|
|
|
9
9
|
|
|
10
10
|
from websockets import (
|
|
11
11
|
ConnectionClosed,
|
|
12
|
+
ConnectionClosedOK,
|
|
12
13
|
WebSocketClientProtocol,
|
|
13
14
|
WebSocketException,
|
|
14
15
|
)
|
|
@@ -142,6 +143,12 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
142
143
|
await asyncio.sleep(0)
|
|
143
144
|
try:
|
|
144
145
|
await self._provider_specific_message_listener()
|
|
146
|
+
except ConnectionClosedOK:
|
|
147
|
+
# RequestManager._ws_message_stream() will rethrow this exception and
|
|
148
|
+
# cause WebsocketConnection to stop the process_subscriptions() loop,
|
|
149
|
+
# or raise ConnectionClosedOK when recv() is called.
|
|
150
|
+
# see: https://github.com/ethereum/web3.py/pull/3424
|
|
151
|
+
raise
|
|
145
152
|
except Exception as e:
|
|
146
153
|
if not self.silence_listener_task_exceptions:
|
|
147
154
|
raise e
|
|
@@ -184,10 +191,6 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
184
191
|
request_cache_key = generate_cache_key(request_id)
|
|
185
192
|
|
|
186
193
|
while True:
|
|
187
|
-
# check if an exception was recorded in the listener task and raise it
|
|
188
|
-
# in the main loop if so
|
|
189
|
-
self._handle_listener_task_exceptions()
|
|
190
|
-
|
|
191
194
|
if request_cache_key in self._request_processor._request_response_cache:
|
|
192
195
|
self.logger.debug(
|
|
193
196
|
f"Popping response for id {request_id} from cache."
|
|
@@ -197,6 +200,9 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
197
200
|
)
|
|
198
201
|
return popped_response
|
|
199
202
|
else:
|
|
203
|
+
# check if an exception was recorded in the listener task and raise
|
|
204
|
+
# it in the main loop if so
|
|
205
|
+
self._handle_listener_task_exceptions()
|
|
200
206
|
await asyncio.sleep(0)
|
|
201
207
|
|
|
202
208
|
try:
|
|
@@ -136,9 +136,8 @@ class WebsocketProviderV2(PersistentConnectionProvider):
|
|
|
136
136
|
return response
|
|
137
137
|
|
|
138
138
|
async def _provider_specific_message_listener(self) -> None:
|
|
139
|
-
|
|
140
|
-
await
|
|
141
|
-
|
|
139
|
+
while True:
|
|
140
|
+
raw_message = await self._ws.recv()
|
|
142
141
|
response = json.loads(raw_message)
|
|
143
142
|
subscription = response.get("method") == "eth_subscription"
|
|
144
143
|
await self._request_processor.cache_raw_response(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: web3
|
|
3
|
-
Version: 6.20.
|
|
3
|
+
Version: 6.20.2
|
|
4
4
|
Summary: web3.py
|
|
5
5
|
Home-page: https://github.com/ethereum/web3.py
|
|
6
6
|
Author: The Ethereum Foundation
|
|
@@ -24,8 +24,8 @@ Requires-Dist: aiohttp >=3.7.4.post0
|
|
|
24
24
|
Requires-Dist: eth-abi >=4.0.0
|
|
25
25
|
Requires-Dist: eth-account <0.13,>=0.8.0
|
|
26
26
|
Requires-Dist: eth-hash[pycryptodome] >=0.5.1
|
|
27
|
-
Requires-Dist: eth-typing !=4.2.0,>=3.0.0
|
|
28
|
-
Requires-Dist: eth-utils
|
|
27
|
+
Requires-Dist: eth-typing !=4.2.0,<5.0.0,>=3.0.0
|
|
28
|
+
Requires-Dist: eth-utils <5,>=2.1.0
|
|
29
29
|
Requires-Dist: hexbytes <0.4.0,>=0.1.0
|
|
30
30
|
Requires-Dist: jsonschema >=4.0.0
|
|
31
31
|
Requires-Dist: lru-dict <1.3.0,>=1.1.6
|
|
@@ -36,7 +36,7 @@ Requires-Dist: websockets >=10.0.0
|
|
|
36
36
|
Requires-Dist: pyunormalize >=15.0.0
|
|
37
37
|
Requires-Dist: pywin32 >=223 ; platform_system == "Windows"
|
|
38
38
|
Provides-Extra: dev
|
|
39
|
-
Requires-Dist: py-geth
|
|
39
|
+
Requires-Dist: py-geth <4,>=3.14.0 ; extra == 'dev'
|
|
40
40
|
Requires-Dist: sphinx >=5.3.0 ; extra == 'dev'
|
|
41
41
|
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'dev'
|
|
42
42
|
Requires-Dist: towncrier <22,>=21 ; extra == 'dev'
|
|
@@ -66,7 +66,7 @@ Requires-Dist: towncrier <22,>=21 ; extra == 'docs'
|
|
|
66
66
|
Provides-Extra: ipfs
|
|
67
67
|
Requires-Dist: ipfshttpclient ==0.8.0a2 ; extra == 'ipfs'
|
|
68
68
|
Provides-Extra: tester
|
|
69
|
-
Requires-Dist: py-geth
|
|
69
|
+
Requires-Dist: py-geth <4,>=3.14.0 ; extra == 'tester'
|
|
70
70
|
Requires-Dist: eth-tester[py-evm] <0.10.0b1,>=0.9.0b1 ; (python_version <= "3.7") and extra == 'tester'
|
|
71
71
|
Requires-Dist: eth-tester[py-evm] <0.12.0b1,>=0.11.0b1 ; (python_version > "3.7") and extra == 'tester'
|
|
72
72
|
|
|
@@ -195,7 +195,7 @@ web3/_utils/module_testing/eth_module.py,sha256=JQ0XAF5GlvpHn3oeAi2DfltJdCZwHk7J
|
|
|
195
195
|
web3/_utils/module_testing/go_ethereum_admin_module.py,sha256=_c-6SyzZkfAJ-7ySXUpw9FEr4cg-ShRdAGSAHWanCtY,3406
|
|
196
196
|
web3/_utils/module_testing/go_ethereum_personal_module.py,sha256=KzYEcAs_6Ud_gbu6YMOC6HijTdNFiz-qogMCViedmY0,11536
|
|
197
197
|
web3/_utils/module_testing/go_ethereum_txpool_module.py,sha256=5f8XL8-2x3keyGRaITxMQYl9oQzjgqGn8zobB-j9BPs,1176
|
|
198
|
-
web3/_utils/module_testing/module_testing_utils.py,sha256=
|
|
198
|
+
web3/_utils/module_testing/module_testing_utils.py,sha256=_nqhDGaL9JwWrcLJlmnfUTHxzVJ7QPP9YSlpFbMY6jA,6383
|
|
199
199
|
web3/_utils/module_testing/net_module.py,sha256=ifUTC-5fTcQbwpm0X09OdD5RSPnn00T8klFeYe8tTm4,1272
|
|
200
200
|
web3/_utils/module_testing/persistent_connection_provider.py,sha256=2NFjp0ZShOt_D5gmcfrc2ua57mRyeFSZpkqtPgCNUgM,16620
|
|
201
201
|
web3/_utils/module_testing/web3_module.py,sha256=Y4lYglg_kbrpfwGfjekv52h4B7DaWa3uS15KGrCKL7c,9613
|
|
@@ -243,7 +243,7 @@ web3/providers/async_rpc.py,sha256=1tf72qPH8A3IW2ZJus9nORL-PfPgRtmj1YRFASVWyuM,2
|
|
|
243
243
|
web3/providers/auto.py,sha256=-dS_-2nhg2jOA432P0w3Ul3NUIso8rTl4uGUGo0XBw0,3447
|
|
244
244
|
web3/providers/base.py,sha256=qASmfdhXhD2FSk2Uk8z-8NxVL4i42uJNoUlwRDzQpgI,4187
|
|
245
245
|
web3/providers/ipc.py,sha256=xFWT6cY9emTnFMuIQFrmQ0DJMQSMoQtaztD7MTTVniI,6374
|
|
246
|
-
web3/providers/persistent.py,sha256=
|
|
246
|
+
web3/providers/persistent.py,sha256=eSZy825cAV2beVNytcrmCMsjgoAzsa3G-nW00pI8F0M,8782
|
|
247
247
|
web3/providers/rpc.py,sha256=w3XA8lhufp_tcGCqocRwi2DDt8j3fj0hoZGk0dfF0u0,2686
|
|
248
248
|
web3/providers/eth_tester/__init__.py,sha256=J6wazY3hQySsUfpFgwCXbEMo-CGEZjRo11RCg4UXKmA,83
|
|
249
249
|
web3/providers/eth_tester/defaults.py,sha256=Ri_WPJT8aumxwiZXwedkJ16H_gBkLsKqanlDLfeFqM8,14803
|
|
@@ -253,7 +253,7 @@ web3/providers/websocket/__init__.py,sha256=W5xi6NxUVaskom7k03vd2HCXSH8hXAob2ry-
|
|
|
253
253
|
web3/providers/websocket/request_processor.py,sha256=kir6bkAWy6CQdBpNrk_8CB8GPsjXM42SXx7IYlAngqE,11653
|
|
254
254
|
web3/providers/websocket/websocket.py,sha256=-U2-CGtqpysxZoFHsa-rBeZKjSRejqQSeb5Z12SzKwk,3929
|
|
255
255
|
web3/providers/websocket/websocket_connection.py,sha256=_W3i_nF9NNRdSwFGwLsDCNXrrhlhV-NvmywX8vbuWvY,1104
|
|
256
|
-
web3/providers/websocket/websocket_v2.py,sha256=
|
|
256
|
+
web3/providers/websocket/websocket_v2.py,sha256=oVyNeUH7r-RFMy7whLFVRGKhhAC2GIvI6-q5NjlHmjQ,4391
|
|
257
257
|
web3/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
258
258
|
web3/scripts/release/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
259
259
|
web3/scripts/release/test_package.py,sha256=DH0AryllcF4zfpWSd0NLPSQGHNoC-Qng5WYYbS5_4c8,1534
|
|
@@ -275,9 +275,9 @@ web3/utils/address.py,sha256=KC_IpEbixSCuMhaW6V2QCyyJTYKYGS9c8QtI9_aH7zQ,967
|
|
|
275
275
|
web3/utils/async_exception_handling.py,sha256=gfLuzP7Y5rc21jZVjWEYAOZUMJkJd9CmsL297UKReow,3096
|
|
276
276
|
web3/utils/caching.py,sha256=PgfuXiVgPYQuS0S89-jkNOJ3L2uTRt2MkVBvzMkaAXI,1770
|
|
277
277
|
web3/utils/exception_handling.py,sha256=12xkzIqMAOx0Jcm6PYL98PmWlLPKFll0p9YoLGS_ZNg,3052
|
|
278
|
-
web3-6.20.
|
|
279
|
-
web3-6.20.
|
|
280
|
-
web3-6.20.
|
|
281
|
-
web3-6.20.
|
|
282
|
-
web3-6.20.
|
|
283
|
-
web3-6.20.
|
|
278
|
+
web3-6.20.2.dist-info/LICENSE,sha256=ulnXiEqqFp9VyWe8yMFdtDi70RMBJk3mpY3FKujv6l8,1090
|
|
279
|
+
web3-6.20.2.dist-info/METADATA,sha256=HAI2cD-mXi-yXC88_xZQ51_yyyM34nNogWWyrVOcEdw,4538
|
|
280
|
+
web3-6.20.2.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
|
281
|
+
web3-6.20.2.dist-info/entry_points.txt,sha256=2qjzGxFUlYBzoP68fcB3AJyMRunWI70uBoxNp17Brb0,64
|
|
282
|
+
web3-6.20.2.dist-info/top_level.txt,sha256=5lRZg30BFUrz8eUK60C7OAjNT3FI4YsGmA-vZ0WIOik,15
|
|
283
|
+
web3-6.20.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|