py-near 1.1.40__py3-none-any.whl → 1.1.42__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
@@ -148,6 +148,12 @@ class JsonProvider(object):
148
148
  )
149
149
  if r.status == 200:
150
150
  return json.loads(await r.text())
151
+ return {
152
+ "error": {
153
+ "cause": {"name": "RPC_ERROR", "message": f"Status: {r.status}"},
154
+ "data": await r.text(),
155
+ }
156
+ }
151
157
 
152
158
  if broadcast or threshold:
153
159
  pending = [
@@ -155,14 +161,14 @@ class JsonProvider(object):
155
161
  ]
156
162
 
157
163
  responses = []
158
- while len(pending):
164
+ while pending and len(pending):
159
165
  done, pending = await asyncio.wait(
160
166
  pending, return_when=asyncio.FIRST_COMPLETED
161
167
  )
162
168
  for task in done:
163
169
  try:
164
170
  result = task.result()
165
- if "error" not in result and threshold <= 1:
171
+ if "error" not in result and (not threshold or threshold <= 1):
166
172
  return result
167
173
  responses.append(result)
168
174
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.40
3
+ Version: 1.1.42
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=0nv1pnWo0FZ6ZonUbhxVCmnq_gG8vBMiIQ3qhz6toBs,15477
23
+ py_near/providers.py,sha256=1uRxch7rcDCOPcCIV0gcGtNd8omdtM3MVChJiZjTod8,15718
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.40.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
- py_near-1.1.40.dist-info/METADATA,sha256=MLUGiQjTbaNFCyV5qL_IGnHFwBpDlHeJe04WmY37DU4,4713
28
- py_near-1.1.40.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
- py_near-1.1.40.dist-info/RECORD,,
26
+ py_near-1.1.42.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
+ py_near-1.1.42.dist-info/METADATA,sha256=-jADRK62NB3mZoSvfakuNIa5kTeAEqZ5BseeJkN6Eko,4713
28
+ py_near-1.1.42.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
+ py_near-1.1.42.dist-info/RECORD,,