neuronum 1.7.0__py3-none-any.whl → 1.7.2__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.

Potentially problematic release.


This version of neuronum might be problematic. Click here for more details.

cli/main.py CHANGED
@@ -289,6 +289,7 @@ def init_node(sync):
289
289
  ctx = cell.list_ctx()
290
290
  stx = cell.list_stx()
291
291
  contracts = cell.list_contracts()
292
+ nodes = cell.list_nodes()
292
293
 
293
294
  url = f"https://{network}/api/init_node/{node_type}"
294
295
 
@@ -324,6 +325,9 @@ def init_node(sync):
324
325
  contracts_path = project_path / "contracts.json"
325
326
  contracts_path.write_text(json.dumps(contracts, indent=4))
326
327
 
328
+ nodes_path = project_path / "nodes.json"
329
+ nodes_path.write_text(json.dumps(nodes, indent=4))
330
+
327
331
  nodemd_path = project_path / "NODE.md"
328
332
  nodemd_path.write_text("""\
329
333
  ## Use this NODE.md file to add instructions on how to interact with your node
@@ -393,8 +397,6 @@ def stop_node():
393
397
  click.echo("Node stopped successfully!")
394
398
  except FileNotFoundError:
395
399
  click.echo("Error: No active node process found.")
396
- except Exception as e:
397
- click.echo(f"Error stopping node: {e}")
398
400
 
399
401
 
400
402
  @click.command()
@@ -516,16 +518,19 @@ def update_node():
516
518
  ctx = cell.list_ctx()
517
519
  stx = cell.list_stx()
518
520
  contracts = cell.list_contracts()
521
+ nodes = cell.list_nodes()
519
522
 
520
523
  tx_path = Path("transmitters.json")
521
524
  ctx_path = Path("circuits.json")
522
525
  stx_path = Path("streams.json")
523
526
  contracts_path = Path("contracts.json")
527
+ nodes_path = Path("nodes.json")
524
528
 
525
529
  tx_path.write_text(json.dumps(tx, indent=4))
526
530
  ctx_path.write_text(json.dumps(ctx, indent=4))
527
531
  stx_path.write_text(json.dumps(stx, indent=4))
528
532
  contracts_path.write_text(json.dumps(contracts, indent=4))
533
+ nodes_path.write_text(json.dumps(nodes, indent=4))
529
534
 
530
535
  click.echo(f"Neuronum Node '{nodeID}' updated! Visit: {node_url}")
531
536
 
neuronum/neuronum.py CHANGED
@@ -214,7 +214,7 @@ class Cell:
214
214
  }
215
215
 
216
216
  try:
217
- response = requests.post(full_url, json=list_tx)
217
+ response = requests.get(full_url, json=list_tx)
218
218
  response.raise_for_status()
219
219
  return response.json()["Transmitters"]
220
220
  except requests.exceptions.RequestException as e:
@@ -231,7 +231,7 @@ class Cell:
231
231
  }
232
232
 
233
233
  try:
234
- response = requests.post(full_url, json=list_ctx)
234
+ response = requests.get(full_url, json=list_ctx)
235
235
  response.raise_for_status()
236
236
  return response.json()["Circuits"]
237
237
  except requests.exceptions.RequestException as e:
@@ -248,7 +248,7 @@ class Cell:
248
248
  }
249
249
 
250
250
  try:
251
- response = requests.post(full_url, json=list_stx)
251
+ response = requests.get(full_url, json=list_stx)
252
252
  response.raise_for_status()
253
253
  return response.json()["Streams"]
254
254
  except requests.exceptions.RequestException as e:
@@ -256,6 +256,23 @@ class Cell:
256
256
  except Exception as e:
257
257
  print(f"Unexpected error: {e}")
258
258
 
259
+
260
+ def list_nodes(self):
261
+ full_url = f"https://{self.network}/api/list_nodes"
262
+
263
+ list_nodes = {
264
+ "cell": self.to_dict()
265
+ }
266
+
267
+ try:
268
+ response = requests.get(full_url, json=list_nodes)
269
+ response.raise_for_status()
270
+ return response.json()["Nodes"]
271
+ except requests.exceptions.RequestException as e:
272
+ print(f"Error sending request: {e}")
273
+ except Exception as e:
274
+ print(f"Unexpected error: {e}")
275
+
259
276
 
260
277
  def store(self, label: str, data: dict, ctx: Optional[str] = None):
261
278
  if ctx:
@@ -533,7 +550,7 @@ class Cell:
533
550
  }
534
551
 
535
552
  try:
536
- response = requests.post(full_url, json=list_contracts)
553
+ response = requests.get(full_url, json=list_contracts)
537
554
  response.raise_for_status()
538
555
  return response.json()["Contracts"]
539
556
  except requests.exceptions.RequestException as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neuronum
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: Official client library to interact with the Neuronum Network
5
5
  Home-page: https://neuronum.net
6
6
  Author: Neuronum Cybernetics
@@ -22,7 +22,7 @@ Requires-Dist: python-dotenv
22
22
 
23
23
  [![Website](https://img.shields.io/badge/Website-Neuronum-blue)](https://neuronum.net) [![Documentation](https://img.shields.io/badge/Docs-Read%20now-green)](https://github.com/neuronumcybernetics/neuronum)
24
24
 
25
- Build, deploy and automate IoT connectivity with `Neuronum`
25
+ Build, deploy and automate serverless IoT connectivity with `Neuronum`
26
26
 
27
27
  ## Features
28
28
  - **Cells/Cell-CLI**: Create and manage Neuronum Cells from the command line
@@ -99,6 +99,11 @@ Delete a Node:
99
99
  $ neuronum delete-node
100
100
  ```
101
101
 
102
+ List Nodes your Cell can interact with:
103
+ ```python
104
+ nodesList = cell.list_nodes() # list Nodes
105
+ ```
106
+
102
107
  ### Transmitters (TX)
103
108
  Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format
104
109
 
@@ -298,10 +303,11 @@ Contracts are predefined token-based rules to automate service exchange and auth
298
303
  Create a Contract:
299
304
  ```python
300
305
  descr = "Test Contract" # short description (max 25 characters)
301
- details = { # define token details
306
+ details = { # token details
302
307
  "price_in_eur": False, # token price in EUR (int, float or False)
303
308
  "max_usage": False, # max number of uses (int or False)
304
- "validity_in_min": False # token expiration time in min (int, float or False)
309
+ "validity_in_min": False, # token expiration time in min (int, float or False)
310
+ "expiration_date": False # expiration date (DD-MM-YYYY or False)
305
311
  }
306
312
  partners = ["id::cell", "id::cell"]
307
313
  contractID = cell.create_contract(descr, details, partners)
@@ -0,0 +1,10 @@
1
+ cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ cli/main.py,sha256=R0qdrTLstaYVA1I_mknrl8VpFRAkjCcrY45QXFg5qhs,17819
3
+ neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
4
+ neuronum/neuronum.py,sha256=91lOreL7TeD8VWdDCtS2xu7MO34taI4HEYr-Lpv6L9Y,17019
5
+ neuronum-1.7.2.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
6
+ neuronum-1.7.2.dist-info/METADATA,sha256=3USLy4kwOja3yGILOUY-MB1RMOZp5t3GTa3xyQKInuc,13101
7
+ neuronum-1.7.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
8
+ neuronum-1.7.2.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
9
+ neuronum-1.7.2.dist-info/top_level.txt,sha256=ru8Fr84cHm6oHr_DcJ8-uaq3RTiuCRFIr6AC8V0zPu4,13
10
+ neuronum-1.7.2.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cli/main.py,sha256=w4pNMA7ySCKTk4Z-Mb3W7cIw5ZUpLrP92L2HfrcFxSM,17637
3
- neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
4
- neuronum/neuronum.py,sha256=4j3fV7VHPb1KcQucOEDBQ-v2SoG9c2WfGPqMfI3OF88,16498
5
- neuronum-1.7.0.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
6
- neuronum-1.7.0.dist-info/METADATA,sha256=GqgpO0lCzLKJwOfNRH8GzXPbRgsvRvZm3YP5FPVMbNs,12806
7
- neuronum-1.7.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
8
- neuronum-1.7.0.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
9
- neuronum-1.7.0.dist-info/top_level.txt,sha256=ru8Fr84cHm6oHr_DcJ8-uaq3RTiuCRFIr6AC8V0zPu4,13
10
- neuronum-1.7.0.dist-info/RECORD,,