naeural-client 2.7.2__py3-none-any.whl → 2.7.3__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.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.7.2"
1
+ __VER__ = "2.7.3"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
naeural_client/bc/base.py CHANGED
@@ -1492,6 +1492,23 @@ class BaseBlockEngine:
1492
1492
  network=None,
1493
1493
  **kwargs
1494
1494
  ):
1495
+ """
1496
+ Autocompletes the environment with the dAuth information.
1497
+ Parameters
1498
+ ----------
1499
+ dauth_endp
1500
+ add_env
1501
+ debug
1502
+ max_tries
1503
+ network
1504
+ kwargs
1505
+
1506
+ Returns
1507
+ -------
1508
+ None if the URL is invalid or the request failed.
1509
+ dict with the dAuth information if the request got status 200(if errors occured, but
1510
+ the status is still 200, an empty dictionary will be returned).
1511
+ """
1495
1512
  from naeural_client._ver import __VER__ as sdk_version
1496
1513
  try:
1497
1514
  from ver import __VER__ as app_version
@@ -1503,16 +1520,21 @@ class BaseBlockEngine:
1503
1520
  core_version = None
1504
1521
 
1505
1522
  MIN_LEN = 10
1506
- dct_env = {}
1523
+ # Default result in case of invalid URL should be None
1524
+ # An empty dict will mean that the URL is valid, but the node
1525
+ # does not have a license associated with it.
1526
+ dct_env = None
1507
1527
  done = False
1508
1528
  tries = 0
1509
1529
  in_env = False
1510
1530
  url = dauth_endp
1511
1531
  dct_response = {}
1512
-
1532
+
1533
+ # Network handling
1513
1534
  if network is None:
1514
1535
  network = os.environ.get(dAuth.DAUTH_NET_ENV_KEY, dAuth.DAUTH_SDK_NET_DEFAULT)
1515
-
1536
+
1537
+ # URL handling
1516
1538
  if not isinstance(url, str) or len(url) < MIN_LEN:
1517
1539
  if DAUTH_ENV_KEY in os.environ:
1518
1540
  in_env = True
@@ -1525,6 +1547,7 @@ class BaseBlockEngine:
1525
1547
  #endif not in env
1526
1548
 
1527
1549
  if isinstance(url, str) and len(url) > 0:
1550
+ # Valid URL
1528
1551
  if dauth_endp is None:
1529
1552
  if in_env:
1530
1553
  self.P("Found dAuth URL in environment: '{}'".format(url), color='g')
@@ -1569,7 +1592,8 @@ class BaseBlockEngine:
1569
1592
  self.P(f"Signature from {server_alias} <{server_addr}> is valid.", color='g')
1570
1593
  else:
1571
1594
  self.P(f"Signature from {server_alias} <{server_addr}> is INVALID: {ver_result}", color='r')
1572
- return
1595
+ # Invalid response signature, thus return {}
1596
+ return {}
1573
1597
 
1574
1598
  # whitelist
1575
1599
  whitelist = dct_dauth.pop(dAuth.DAUTH_WHITELIST, [])
@@ -1602,13 +1626,16 @@ class BaseBlockEngine:
1602
1626
  else:
1603
1627
  self.P(f"Error in dAuth response: {response.status_code} - {response.text}", color='r')
1604
1628
  except Exception as exc:
1605
- self.P(f"Error in dAuth URL request: {exc}. Received: {dct_response}", color='r')
1629
+ self.P(f"Error in dAuth URL request: {exc}. Received: {dct_response}", color='r')
1630
+ # Request failed somewhere so dct_env will be set again to None.
1631
+ dct_env = None
1606
1632
  #end try
1607
1633
  tries += 1
1608
1634
  if tries >= max_tries:
1609
1635
  done = True
1610
1636
  #end while
1611
1637
  else:
1638
+ # Invalid URL, thus dct_env will remain None
1612
1639
  self.P(f"dAuth URL is not invalid: {url}", color='r')
1613
1640
  #end if url is valid
1614
1641
  return dct_env
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.2
3
+ Version: 2.7.3
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -1,5 +1,5 @@
1
1
  naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=AmgLw7G8mfS_s_ZcTp4-jO55cd6nqLC-drbp7VIRGKQ,330
2
+ naeural_client/_ver.py,sha256=nDVrulMfL35a57x2FvSgElM6f3wFtjsC43Smx4Z-Jlk,330
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
@@ -14,7 +14,7 @@ naeural_client/base/webapp_pipeline.py,sha256=ZNGqZ36DY076XVDfGu2Q61kCt3kxIJ4Mi4
14
14
  naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
15
15
  naeural_client/base/payload/payload.py,sha256=x-au7l67Z_vfn_4R2C_pjZCaFuUVXHngJiGOfIAYVdE,2690
16
16
  naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
17
- naeural_client/bc/base.py,sha256=wfNdwr-dWPftRkq0YdaBZ1xhzdhnz220bpFqqH8iVQM,45152
17
+ naeural_client/bc/base.py,sha256=H2ke33T_Iflf_viGvi7ceyJ5S_I_aJLk9UZoTckTzpk,45988
18
18
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  naeural_client/bc/ec.py,sha256=-HPfKpYAqy_eZpiJf3gWR2L4ZDDP7fZY2uwdNYYmS80,23868
20
20
  naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -84,8 +84,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
84
84
  naeural_client/utils/config.py,sha256=GzduH5_ZFN39RBdpICDKhx2ZqXen5fF-JJ0RoEcF2wQ,7401
85
85
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
86
86
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=GmZwu2JM9_UB2K-4rKB3o0RgWLqM-7Im6HwBnQLXmHI,25312
87
- naeural_client-2.7.2.dist-info/METADATA,sha256=CRSL1yY8peBB8gvFqm8vfE3tNERLigtRqGmk7cAohy8,12353
88
- naeural_client-2.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
- naeural_client-2.7.2.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
90
- naeural_client-2.7.2.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
91
- naeural_client-2.7.2.dist-info/RECORD,,
87
+ naeural_client-2.7.3.dist-info/METADATA,sha256=eFUx-ggIYpO0_8WcUqUVJG9IWyS1ULDRh1OBbKpMvnM,12353
88
+ naeural_client-2.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
+ naeural_client-2.7.3.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
90
+ naeural_client-2.7.3.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
91
+ naeural_client-2.7.3.dist-info/RECORD,,