py-near 1.1.45__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
@@ -172,6 +172,8 @@ class JsonProvider(object):
172
172
 
173
173
  responses = []
174
174
  correct_responses = []
175
+ result = None
176
+
175
177
  while pending and len(pending):
176
178
  done, pending = await asyncio.wait(
177
179
  pending, return_when=asyncio.FIRST_COMPLETED
@@ -194,8 +196,11 @@ class JsonProvider(object):
194
196
  for task in pending:
195
197
  task.cancel()
196
198
  return most_frequent_element
197
- raise RpcEmptyResponse(f"Threshold not reached: {len(correct_responses)}/{threshold}")
199
+ if threshold and threshold > 0:
200
+ raise RpcEmptyResponse(f"Threshold not reached: {len(correct_responses)}/{threshold}")
201
+ return result
198
202
  else:
203
+ res = None
199
204
  for rpc_addr in self._available_rpcs:
200
205
  try:
201
206
  res = await f(rpc_addr)
@@ -204,6 +209,7 @@ class JsonProvider(object):
204
209
  except Exception as e:
205
210
  logger.error(f"Rpc error: {e}")
206
211
  continue
212
+ return res
207
213
  raise RpcEmptyResponse("RPC returned empty response")
208
214
 
209
215
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.45
3
+ Version: 1.1.46
4
4
  Summary: Pretty simple and fully asynchronous framework for working with NEAR blockchain
5
5
  Author: pvolnov
6
6
  Author-email: petr@herewallet.app
@@ -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=Z7Zzcor-B-jMgLoz2Injmxe9LhdszBtCoC2zYbTScJQ,16557
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.45.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
- py_near-1.1.45.dist-info/METADATA,sha256=wD-DlYJ16hIJ6u49RWcRp8rb_Kn7-kHp8VVdRo7vGII,4713
28
- py_near-1.1.45.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
- py_near-1.1.45.dist-info/RECORD,,
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,,