py-near 1.1.44__py3-none-any.whl → 1.1.46__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.
py_near/providers.py
CHANGED
@@ -61,10 +61,9 @@ class JsonProvider(object):
|
|
61
61
|
self._last_rpc_addr_check = 0
|
62
62
|
self.allow_broadcast = allow_broadcast
|
63
63
|
self._timeout = timeout
|
64
|
-
self.session = aiohttp.ClientSession()
|
65
64
|
|
66
65
|
async def shutdown(self):
|
67
|
-
|
66
|
+
pass
|
68
67
|
|
69
68
|
async def check_available_rpcs(self):
|
70
69
|
if (
|
@@ -173,6 +172,8 @@ class JsonProvider(object):
|
|
173
172
|
|
174
173
|
responses = []
|
175
174
|
correct_responses = []
|
175
|
+
result = None
|
176
|
+
|
176
177
|
while pending and len(pending):
|
177
178
|
done, pending = await asyncio.wait(
|
178
179
|
pending, return_when=asyncio.FIRST_COMPLETED
|
@@ -195,8 +196,11 @@ class JsonProvider(object):
|
|
195
196
|
for task in pending:
|
196
197
|
task.cancel()
|
197
198
|
return most_frequent_element
|
198
|
-
|
199
|
+
if threshold and threshold > 0:
|
200
|
+
raise RpcEmptyResponse(f"Threshold not reached: {len(correct_responses)}/{threshold}")
|
201
|
+
return result
|
199
202
|
else:
|
203
|
+
res = None
|
200
204
|
for rpc_addr in self._available_rpcs:
|
201
205
|
try:
|
202
206
|
res = await f(rpc_addr)
|
@@ -205,6 +209,7 @@ class JsonProvider(object):
|
|
205
209
|
except Exception as e:
|
206
210
|
logger.error(f"Rpc error: {e}")
|
207
211
|
continue
|
212
|
+
return res
|
208
213
|
raise RpcEmptyResponse("RPC returned empty response")
|
209
214
|
|
210
215
|
@staticmethod
|
@@ -20,10 +20,10 @@ py_near/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
20
20
|
py_near/exceptions/exceptions.py,sha256=DEFipaAHm0y7oCuN2QKzHsiQvUTUQVl-Ce36Ag7n7hs,5509
|
21
21
|
py_near/exceptions/provider.py,sha256=K-wexgjPJ8sw42JePwaP7R5dJEIn9DoFJRvVcURsx6s,7718
|
22
22
|
py_near/models.py,sha256=GZQD1TKGWlwqsJsKRXrVNBjCdAIpk7GQypU-QOtAPFs,11533
|
23
|
-
py_near/providers.py,sha256=
|
23
|
+
py_near/providers.py,sha256=6E3Q6C3gDEMnoDbrM4DObXQkWB164t6xagQpRbjqXUg,16704
|
24
24
|
py_near/transactions.py,sha256=QAXegv2JpKISk92NaChtIH6-QPHrcWbrwdKH_lH4TsU,3186
|
25
25
|
py_near/utils.py,sha256=FirRH93ydH1cwjn0-sNrZeIn3BRD6QHedrP2VkAdJ6g,126
|
26
|
-
py_near-1.1.
|
27
|
-
py_near-1.1.
|
28
|
-
py_near-1.1.
|
29
|
-
py_near-1.1.
|
26
|
+
py_near-1.1.46.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
|
27
|
+
py_near-1.1.46.dist-info/METADATA,sha256=qlYIKcezSCERYuOv6bkrNdatgHCAbz0T3u8vqKMfjXE,4713
|
28
|
+
py_near-1.1.46.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
29
|
+
py_near-1.1.46.dist-info/RECORD,,
|
File without changes
|
File without changes
|