naeural-client 2.6.2__py3-none-any.whl → 2.6.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.6.2"
1
+ __VER__ = "2.6.4"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
naeural_client/bc/base.py CHANGED
@@ -1218,6 +1218,7 @@ class BaseBlockEngine:
1218
1218
 
1219
1219
  def dauth_autocomplete(self, dauth_endp=None, add_env=True, debug=False, max_tries=5):
1220
1220
  dct_env = {}
1221
+ dct_result = {}
1221
1222
  done = False
1222
1223
  tries = 0
1223
1224
  in_env = False
@@ -1242,28 +1243,31 @@ class BaseBlockEngine:
1242
1243
  }
1243
1244
  self.sign(nonce_data)
1244
1245
  response = requests.post(url, json={'body' : nonce_data})
1245
- dct_response = response.json()
1246
- if debug:
1247
- self.P(f"Response:\n {json.dumps(dct_response, indent=2)}")
1248
- dct_result = dct_response.get('result', {}).get(DAUTH_SUBKEY, {})
1249
- error = dct_response.get('error', None)
1250
- if error is not None:
1251
- self.P(f"Error in dAuth response: {dct_response}", color='r')
1252
- dct_env = {k : v for k,v in dct_result.items() if k.startswith('EE_')}
1253
- self.P("Found {} keys in dAuth response.".format(len(dct_env)), color='g')
1254
- for k, v in dct_env.items():
1255
- try:
1256
- if not isinstance(v, str):
1257
- v = json.dumps(v)
1258
- except:
1259
- v = str(v)
1260
- if k not in os.environ:
1261
- self.P(f" Adding key `{k}{'=' + str(v) + ' ({})'.format(type(v).__name__) if debug else ''}` to env.", color='y')
1262
- else:
1263
- self.P(f" Overwrite `{k}{'=' + str(v) + ' ({})'.format(type(v).__name__) if debug else ''}` in env.", color='y')
1264
- if add_env:
1265
- os.environ[k] = v
1266
- done = True
1246
+ if response.status_code == 200:
1247
+ dct_response = response.json()
1248
+ if debug:
1249
+ self.P(f"Response:\n {json.dumps(dct_response, indent=2)}")
1250
+ dct_result = dct_response.get('result', {}).get(DAUTH_SUBKEY, {})
1251
+ error = dct_response.get('error', None)
1252
+ if error is not None:
1253
+ self.P(f"Error in dAuth response: {dct_response}", color='r')
1254
+ dct_env = {k : v for k,v in dct_result.items() if k.startswith('EE_')}
1255
+ self.P("Found {} keys in dAuth response.".format(len(dct_env)), color='g')
1256
+ for k, v in dct_env.items():
1257
+ try:
1258
+ if not isinstance(v, str):
1259
+ v = json.dumps(v)
1260
+ except:
1261
+ v = str(v)
1262
+ if k not in os.environ:
1263
+ self.P(f" Adding key `{k}{'=' + str(v) + ' ({})'.format(type(v).__name__) if debug else ''}` to env.", color='y')
1264
+ else:
1265
+ self.P(f" Overwrite `{k}{'=' + str(v) + ' ({})'.format(type(v).__name__) if debug else ''}` in env.", color='y')
1266
+ if add_env:
1267
+ os.environ[k] = v
1268
+ done = True
1269
+ else:
1270
+ self.P(f"Error in dAuth response: {response.status_code} - {response.text}", color='r')
1267
1271
  except Exception as exc:
1268
1272
  self.P(f"Error in dAuth URL request: {exc}. Received: {dct_result}", color='r')
1269
1273
  #end try
@@ -335,7 +335,13 @@ class BaseLogger(object):
335
335
  return False
336
336
 
337
337
  @staticmethod
338
- def replace_secrets(dct_config, pattern='$EE_', allow_missing=False):
338
+ def replace_secrets(dct_config, pattern='$EE_', allow_missing=True, missing_default=None):
339
+ """
340
+ TODO: maybe move to Jinja2 style
341
+ "{{ some_variable | default('my_default') }}"
342
+
343
+
344
+ """
339
345
  matches = []
340
346
  missing = []
341
347
  stack = [dct_config]
@@ -350,7 +356,7 @@ class BaseLogger(object):
350
356
  if env_var_name not in os.environ:
351
357
  missing.append(env_var_name)
352
358
  if allow_missing:
353
- current[key] = None
359
+ current[key] = missing_default
354
360
  else:
355
361
  current[key] = os.environ[env_var_name]
356
362
  elif isinstance(value, (dict, list)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.6.2
3
+ Version: 2.6.4
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=AbybJH5c6eadgP3bkXR3ov9QJDoxs0clx8-41oDO_Pc,330
2
+ naeural_client/_ver.py,sha256=PjIkiMwxccYumKTmIilKwwr-ukjI-vjW09AHPfEu9BM,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=QmPLVmhP0CPdi0YuvbZEH4APYz2Amtw3gy
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=Egi9g_uW49QiRHx5xHr3GboM5Po3UG06VlOFnRXGcd0,34511
17
+ naeural_client/bc/base.py,sha256=Nlt-8PQrUcN5W2j67hZYmUNRZVQh-QXTqya06rwlFoA,34733
18
18
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  naeural_client/bc/ec.py,sha256=qI8l7YqiS4MNftlx-tF7IZUswrSeQc7KMn5OZ0fEaJs,23370
20
20
  naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -57,7 +57,7 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
57
57
  naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
58
58
  naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
59
59
  naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
60
- naeural_client/logging/base_logger.py,sha256=K3pFqtM8bjQ8w9LqKXbDZodh77ZO-stTW_wN5KVe14U,66242
60
+ naeural_client/logging/base_logger.py,sha256=9H4ShdG4gsUCyznwficU4iym_kLZdNaxRAD_INfLV68,66392
61
61
  naeural_client/logging/small_logger.py,sha256=m12hCb_H4XifJYYfgCAOUDkcXm-h4pSODnFf277OFVI,2937
62
62
  naeural_client/logging/logger_mixins/__init__.py,sha256=yQO7umlRvz63FeWpi-F9GRmC_MOHcNW6R6pwvZZBy3A,600
63
63
  naeural_client/logging/logger_mixins/class_instance_mixin.py,sha256=xUXE2VZgmrlrSrvw0f6GF1jlTnVLeVkIiG0bhlBfq3o,2741
@@ -81,8 +81,8 @@ naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uw
81
81
  naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
82
82
  naeural_client/utils/config.py,sha256=v7xHikr6Z5Sbvf3opYeMhYzGWD2pe0HlRwa-aGJzUh8,6323
83
83
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
84
- naeural_client-2.6.2.dist-info/METADATA,sha256=msLG-t5YoIqHlVFX12bvBF6TaPgiyg6HGT_bfI_3kG4,14618
85
- naeural_client-2.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
- naeural_client-2.6.2.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
87
- naeural_client-2.6.2.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
88
- naeural_client-2.6.2.dist-info/RECORD,,
84
+ naeural_client-2.6.4.dist-info/METADATA,sha256=pK2L5nmZU0IwXd8W6th-0_e5Qg4R73bFX9tbI0m3UoE,14618
85
+ naeural_client-2.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
+ naeural_client-2.6.4.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
87
+ naeural_client-2.6.4.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
88
+ naeural_client-2.6.4.dist-info/RECORD,,