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

neuronum/__init__.py CHANGED
@@ -1,5 +1,2 @@
1
- # neuronum/__init__.py
2
-
3
1
  from .neuronum import Cell
4
-
5
2
  __all__ = ['Cell']
neuronum/neuronum.py CHANGED
@@ -2,6 +2,8 @@ import requests
2
2
  import socket
3
3
  from typing import Optional
4
4
  import ssl
5
+ from websocket import create_connection
6
+ from typing import List
5
7
 
6
8
 
7
9
  class Cell:
@@ -200,5 +202,29 @@ class Cell:
200
202
  return "Authentication successful" in response
201
203
 
202
204
 
205
+ def sync(self, STX: str) -> List[str]:
206
+ data = []
207
+ try:
208
+ ws = create_connection(f"wss://{self.network}/ws/{STX}")
209
+ print(f"Connected to Stream {STX}")
210
+ except Exception as e:
211
+ print(f"Failed to connect: {e}")
212
+ return data
213
+
214
+ try:
215
+ while True:
216
+ message = ws.recv()
217
+ print(f"Received Data: {message}")
218
+ data.append(message)
219
+ except KeyboardInterrupt:
220
+ print("Closing connection...")
221
+ except Exception as e:
222
+ print(f"Error during data collection: {e}")
223
+ finally:
224
+ ws.close()
225
+ print("Connection closed.")
226
+
227
+ return data
228
+
203
229
 
204
230
  __all__ = ['Cell']
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neuronum
3
- Version: 1.1.2
3
+ Version: 1.2.1
4
4
  Summary: Interact with the Neuronum Network to build, connect & automate economic data streams
5
+ Home-page: https://neuronum.net
5
6
  Author: Neuronum Cybernetics
6
7
  Author-email: welcome@neuronum.net
8
+ Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
7
9
  Classifier: Programming Language :: Python :: 3
8
10
  Classifier: License :: OSI Approved :: MIT License
9
11
  Classifier: Operating System :: OS Independent
@@ -11,8 +13,10 @@ Requires-Python: >=3.6
11
13
  Description-Content-Type: text/markdown
12
14
  License-File: LICENSE
13
15
  Requires-Dist: requests
16
+ Requires-Dist: websocket-client
14
17
 
15
18
  ![Neuronum Logo](https://neuronum.net/static/logo_pip.png "Neuronum")
19
+
16
20
  [![Website](https://img.shields.io/badge/Website-Neuronum-blue)](https://neuronum.net)
17
21
  [![Documentation](https://img.shields.io/badge/Docs-Read%20now-green)](https://neuronum.net/docs)
18
22
  [![Tutorials](https://img.shields.io/badge/Tutorials-Watch%20now-red)](https://www.youtube.com/@neuronumnet)
@@ -55,10 +59,9 @@ Activate Transmitter (TX):
55
59
  TX = "id::tx"
56
60
 
57
61
  data = {
58
- "key1": "value1",
59
- "key2": "value2",
60
- "key3": "value3",
61
- "key4": "value4"
62
+ "key1": "value1",
63
+ "key2": "value2",
64
+ "key3": "value3",
62
65
  }
63
66
 
64
67
  cell.activate(TX, data)
@@ -68,9 +71,9 @@ Store data on your private Circuit (CTX):
68
71
  ```bash
69
72
  label = "your_label"
70
73
  data = {
71
- "key1": "value1",
72
- "key2": "value2",
73
- "key3": "value3",
74
+ "key1": "value1",
75
+ "key2": "value2",
76
+ "key3": "value3",
74
77
  }
75
78
  cell.store(label, data)
76
79
  ```
@@ -81,9 +84,9 @@ CTX = "id::ctx"
81
84
 
82
85
  label = "your_label"
83
86
  data = {
84
- "key1": "value1",
85
- "key2": "value2",
86
- "key3": "value3",
87
+ "key1": "value1",
88
+ "key2": "value2",
89
+ "key3": "value3",
87
90
  }
88
91
  cell.store(label, data, CTX)
89
92
  ```
@@ -96,7 +99,6 @@ data = cell.load(label)
96
99
  key1 = data["key1"]
97
100
  key2 = data["key2"]
98
101
  key3 = data["key3"]
99
- print(key1, key2, key3)
100
102
  ```
101
103
 
102
104
  Load data from a public Circuit (CTX):
@@ -109,7 +111,6 @@ data = cell.load(label, CTX)
109
111
  key1 = data["key1"]
110
112
  key2 = data["key2"]
111
113
  key3 = data["key3"]
112
- print(key1, key2, key3)
113
114
  ```
114
115
 
115
116
  Delete data from your private Circuit (CTX):
@@ -131,3 +132,10 @@ Stream data:
131
132
  data = "your_data"
132
133
  cell.stream(data)
133
134
  ```
135
+
136
+ Sync data:
137
+ ```bash
138
+ STX = "stx::id"
139
+ data = cell.sync(STX)
140
+ ```
141
+
@@ -0,0 +1,7 @@
1
+ neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
2
+ neuronum/neuronum.py,sha256=nn_vEskQyALPRXZTuWPn89kXqkut9vMPGC9t-WNaYzM,6999
3
+ neuronum-1.2.1.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
4
+ neuronum-1.2.1.dist-info/METADATA,sha256=dmrkgRF0rbHh4q1tVI12uQBj4jg-5Lw4w3tvI9indy4,3214
5
+ neuronum-1.2.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
+ neuronum-1.2.1.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
7
+ neuronum-1.2.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- neuronum/__init__.py,sha256=P0KTJMGY_eT3l5YzR4LHfl64KH5Qt_qhcrqf9Ld2G00,74
2
- neuronum/neuronum.py,sha256=gDzg9aN4jjaBnKLLD9YRSvmV1uffKZOBJb8Fv-WDtfM,6186
3
- neuronum-1.1.2.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
4
- neuronum-1.1.2.dist-info/METADATA,sha256=2deXbg_Q7YsY0apxQhWeNnaX1WKSHWDdy2YJlGHr9-A,3086
5
- neuronum-1.1.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
- neuronum-1.1.2.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
7
- neuronum-1.1.2.dist-info/RECORD,,