neuronum 1.4.1__py3-none-any.whl → 1.5.0__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/neuronum.py +260 -58
- neuronum-1.5.0.dist-info/METADATA +266 -0
- neuronum-1.5.0.dist-info/RECORD +7 -0
- neuronum-1.4.1.dist-info/METADATA +0 -195
- neuronum-1.4.1.dist-info/RECORD +0 -7
- {neuronum-1.4.1.dist-info → neuronum-1.5.0.dist-info}/LICENSE +0 -0
- {neuronum-1.4.1.dist-info → neuronum-1.5.0.dist-info}/WHEEL +0 -0
- {neuronum-1.4.1.dist-info → neuronum-1.5.0.dist-info}/top_level.txt +0 -0
neuronum/neuronum.py
CHANGED
|
@@ -5,7 +5,6 @@ import ssl
|
|
|
5
5
|
from websocket import create_connection
|
|
6
6
|
import json
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
class Cell:
|
|
10
9
|
def __init__(self, host: str, password: str, network: str, synapse: str):
|
|
11
10
|
self.host = host
|
|
@@ -30,12 +29,63 @@ class Cell:
|
|
|
30
29
|
self.sock.sendall(credentials.encode('utf-8'))
|
|
31
30
|
|
|
32
31
|
response = self.sock.recv(1024).decode('utf-8')
|
|
33
|
-
print(response)
|
|
34
32
|
return "Authentication successful" in response
|
|
35
33
|
|
|
36
34
|
|
|
37
|
-
def
|
|
38
|
-
url = f"https://{self.network}/
|
|
35
|
+
def create_tx(self, descr: str, key_values: dict, ctx: str, label: str, partners: list):
|
|
36
|
+
url = f"https://{self.network}/api/create_tx"
|
|
37
|
+
|
|
38
|
+
TX = {
|
|
39
|
+
"descr": descr,
|
|
40
|
+
"key_values": key_values,
|
|
41
|
+
"ctx": ctx,
|
|
42
|
+
"label": label,
|
|
43
|
+
"partners": partners,
|
|
44
|
+
"cell": self.to_dict()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
response = requests.post(
|
|
49
|
+
url,
|
|
50
|
+
json=TX,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
response.raise_for_status()
|
|
54
|
+
|
|
55
|
+
return response.json()["txID"]
|
|
56
|
+
|
|
57
|
+
except requests.exceptions.RequestException as e:
|
|
58
|
+
print(f"Error sending request: {e}")
|
|
59
|
+
except Exception as e:
|
|
60
|
+
print(f"Unexpected error: {e}")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def delete_tx(self, txID: str):
|
|
64
|
+
url = f"https://{self.network}/api/delete_tx"
|
|
65
|
+
|
|
66
|
+
TX = {
|
|
67
|
+
"txID": txID,
|
|
68
|
+
"cell": self.to_dict()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
response = requests.post(
|
|
73
|
+
url,
|
|
74
|
+
json=TX,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
response.raise_for_status()
|
|
78
|
+
|
|
79
|
+
print(f"Response from Neuronum: {response.json()}")
|
|
80
|
+
|
|
81
|
+
except requests.exceptions.RequestException as e:
|
|
82
|
+
print(f"Error sending request: {e}")
|
|
83
|
+
except Exception as e:
|
|
84
|
+
print(f"Unexpected error: {e}")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def activate_tx(self, txID: str, data: dict):
|
|
88
|
+
url = f"https://{self.network}/api/activate_tx/{txID}"
|
|
39
89
|
|
|
40
90
|
TX = {
|
|
41
91
|
"data": data,
|
|
@@ -58,17 +108,114 @@ class Cell:
|
|
|
58
108
|
print(f"Unexpected error: {e}")
|
|
59
109
|
|
|
60
110
|
|
|
111
|
+
def create_ctx(self, descr: str, partners: list):
|
|
112
|
+
url = f"https://{self.network}/api/create_ctx"
|
|
113
|
+
|
|
114
|
+
CTX = {
|
|
115
|
+
"descr": descr,
|
|
116
|
+
"partners": partners,
|
|
117
|
+
"cell": self.to_dict()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
response = requests.post(
|
|
122
|
+
url,
|
|
123
|
+
json=CTX,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
response.raise_for_status()
|
|
127
|
+
|
|
128
|
+
return response.json()["ctxID"]
|
|
129
|
+
|
|
130
|
+
except requests.exceptions.RequestException as e:
|
|
131
|
+
print(f"Error sending request: {e}")
|
|
132
|
+
except Exception as e:
|
|
133
|
+
print(f"Unexpected error: {e}")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def delete_ctx(self, ctxID: str):
|
|
137
|
+
url = f"https://{self.network}/api/delete_ctx"
|
|
138
|
+
|
|
139
|
+
CTX = {
|
|
140
|
+
"ctxID": ctxID,
|
|
141
|
+
"cell": self.to_dict()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
try:
|
|
145
|
+
response = requests.post(
|
|
146
|
+
url,
|
|
147
|
+
json=CTX,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
response.raise_for_status()
|
|
151
|
+
|
|
152
|
+
print(f"Response from Neuronum: {response.json()}")
|
|
153
|
+
|
|
154
|
+
except requests.exceptions.RequestException as e:
|
|
155
|
+
print(f"Error sending request: {e}")
|
|
156
|
+
except Exception as e:
|
|
157
|
+
print(f"Unexpected error: {e}")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def create_stx(self, descr: str, partners: list):
|
|
161
|
+
url = f"https://{self.network}/api/create_stx"
|
|
162
|
+
|
|
163
|
+
STX = {
|
|
164
|
+
"descr": descr,
|
|
165
|
+
"partners": partners,
|
|
166
|
+
"cell": self.to_dict()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
response = requests.post(
|
|
171
|
+
url,
|
|
172
|
+
json=STX,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
response.raise_for_status()["stxID"]
|
|
176
|
+
|
|
177
|
+
return response.json()
|
|
178
|
+
|
|
179
|
+
except requests.exceptions.RequestException as e:
|
|
180
|
+
print(f"Error sending request: {e}")
|
|
181
|
+
except Exception as e:
|
|
182
|
+
print(f"Unexpected error: {e}")
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def delete_stx(self, stxID: str):
|
|
186
|
+
url = f"https://{self.network}/api/delete_stx"
|
|
187
|
+
|
|
188
|
+
STX = {
|
|
189
|
+
"stxID": stxID,
|
|
190
|
+
"cell": self.to_dict()
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
try:
|
|
194
|
+
response = requests.post(
|
|
195
|
+
url,
|
|
196
|
+
json=STX,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
response.raise_for_status()
|
|
200
|
+
|
|
201
|
+
print(f"Response from Neuronum: {response.json()}")
|
|
202
|
+
|
|
203
|
+
except requests.exceptions.RequestException as e:
|
|
204
|
+
print(f"Error sending request: {e}")
|
|
205
|
+
except Exception as e:
|
|
206
|
+
print(f"Unexpected error: {e}")
|
|
207
|
+
|
|
61
208
|
|
|
62
|
-
def
|
|
209
|
+
def register_node(self, descr: str, mode: str, stx: str):
|
|
63
210
|
if mode == "public":
|
|
64
|
-
url = f"https://{self.network}/
|
|
211
|
+
url = f"https://{self.network}/api/register_node/public"
|
|
65
212
|
elif mode == "private":
|
|
66
|
-
url = f"https://{self.network}/
|
|
213
|
+
url = f"https://{self.network}/api/register_node/private"
|
|
67
214
|
else:
|
|
68
215
|
return {"error": "Invalid mode", "message": "Mode has to be 'public' or 'private'"}
|
|
69
216
|
|
|
70
217
|
node_data = {
|
|
71
|
-
"
|
|
218
|
+
"descr": descr,
|
|
72
219
|
"mode": mode,
|
|
73
220
|
"stream": stx,
|
|
74
221
|
"cell": self.to_dict()
|
|
@@ -82,7 +229,7 @@ class Cell:
|
|
|
82
229
|
|
|
83
230
|
response.raise_for_status()
|
|
84
231
|
|
|
85
|
-
|
|
232
|
+
return response.json()["nodeID"]
|
|
86
233
|
|
|
87
234
|
except requests.exceptions.RequestException as e:
|
|
88
235
|
print(f"Error sending request: {e}")
|
|
@@ -90,9 +237,85 @@ class Cell:
|
|
|
90
237
|
print(f"Unexpected error: {e}")
|
|
91
238
|
|
|
92
239
|
|
|
240
|
+
def delete_node(self, nodeID: str):
|
|
241
|
+
url = f"https://{self.network}/api/delete_node"
|
|
242
|
+
|
|
243
|
+
delete_node = {
|
|
244
|
+
"nodeID": nodeID,
|
|
245
|
+
"cell": self.to_dict()
|
|
246
|
+
}
|
|
93
247
|
|
|
94
|
-
|
|
95
|
-
|
|
248
|
+
try:
|
|
249
|
+
response = requests.post(
|
|
250
|
+
url,
|
|
251
|
+
json=delete_node,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
response.raise_for_status()
|
|
255
|
+
print(response.json())
|
|
256
|
+
|
|
257
|
+
except requests.exceptions.RequestException as e:
|
|
258
|
+
print(f"Error sending request: {e}")
|
|
259
|
+
except Exception as e:
|
|
260
|
+
print(f"Unexpected error: {e}")
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def list_tx(self, cellID: str):
|
|
264
|
+
full_url = f"https://{self.network}/api/list_tx"
|
|
265
|
+
|
|
266
|
+
list_tx = {
|
|
267
|
+
"cell": self.to_dict(),
|
|
268
|
+
"cellID": cellID
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
try:
|
|
272
|
+
response = requests.post(full_url, json=list_tx)
|
|
273
|
+
response.raise_for_status()
|
|
274
|
+
return response.json()
|
|
275
|
+
except requests.exceptions.RequestException as e:
|
|
276
|
+
print(f"Error sending request: {e}")
|
|
277
|
+
except Exception as e:
|
|
278
|
+
print(f"Unexpected error: {e}")
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def list_ctx(self, cellID: str):
|
|
282
|
+
full_url = f"https://{self.network}/api/list_ctx"
|
|
283
|
+
|
|
284
|
+
list_ctx = {
|
|
285
|
+
"cell": self.to_dict(),
|
|
286
|
+
"cellID": cellID
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
try:
|
|
290
|
+
response = requests.post(full_url, json=list_ctx)
|
|
291
|
+
response.raise_for_status()
|
|
292
|
+
return response.json()
|
|
293
|
+
except requests.exceptions.RequestException as e:
|
|
294
|
+
print(f"Error sending request: {e}")
|
|
295
|
+
except Exception as e:
|
|
296
|
+
print(f"Unexpected error: {e}")
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def list_stx(self, cellID: str):
|
|
300
|
+
full_url = f"https://{self.network}/api/list_stx"
|
|
301
|
+
|
|
302
|
+
list_stx = {
|
|
303
|
+
"cell": self.to_dict(),
|
|
304
|
+
"cellID": cellID
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
try:
|
|
308
|
+
response = requests.post(full_url, json=list_stx)
|
|
309
|
+
response.raise_for_status()
|
|
310
|
+
return response.json()
|
|
311
|
+
except requests.exceptions.RequestException as e:
|
|
312
|
+
print(f"Error sending request: {e}")
|
|
313
|
+
except Exception as e:
|
|
314
|
+
print(f"Unexpected error: {e}")
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def connect(self):
|
|
318
|
+
url = f"https://{self.network}/api/connect"
|
|
96
319
|
|
|
97
320
|
test = {
|
|
98
321
|
"cell": self.to_dict()
|
|
@@ -101,7 +324,7 @@ class Cell:
|
|
|
101
324
|
try:
|
|
102
325
|
response = requests.post(url, json=test)
|
|
103
326
|
response.raise_for_status()
|
|
104
|
-
print(response.json())
|
|
327
|
+
print(response.json()["connection"])
|
|
105
328
|
except requests.exceptions.RequestException as e:
|
|
106
329
|
print(f"Error sending request: {e}")
|
|
107
330
|
except Exception as e:
|
|
@@ -110,9 +333,9 @@ class Cell:
|
|
|
110
333
|
|
|
111
334
|
def store(self, label: str, data: dict, ctx: Optional[str] = None):
|
|
112
335
|
if ctx:
|
|
113
|
-
full_url = f"https://{self.network}/
|
|
336
|
+
full_url = f"https://{self.network}/api/store_in_ctx/{ctx}"
|
|
114
337
|
else:
|
|
115
|
-
full_url = f"https://{self.network}/store"
|
|
338
|
+
full_url = f"https://{self.network}/api/store"
|
|
116
339
|
|
|
117
340
|
store = {
|
|
118
341
|
"label": label,
|
|
@@ -130,14 +353,11 @@ class Cell:
|
|
|
130
353
|
print(f"Unexpected error: {e}")
|
|
131
354
|
|
|
132
355
|
|
|
133
|
-
|
|
134
356
|
def load(self, label: str, ctx: Optional[str] = None):
|
|
135
357
|
if ctx:
|
|
136
|
-
full_url = f"https://{self.network}/
|
|
358
|
+
full_url = f"https://{self.network}/api/load_from_ctx/{ctx}"
|
|
137
359
|
else:
|
|
138
|
-
full_url = f"https://{self.network}/load"
|
|
139
|
-
|
|
140
|
-
print(f"Full URL: {full_url}")
|
|
360
|
+
full_url = f"https://{self.network}/api/load"
|
|
141
361
|
|
|
142
362
|
load = {
|
|
143
363
|
"label": label,
|
|
@@ -154,14 +374,11 @@ class Cell:
|
|
|
154
374
|
print(f"Unexpected error: {e}")
|
|
155
375
|
|
|
156
376
|
|
|
157
|
-
|
|
158
377
|
def delete(self, label: str, ctx: Optional[str] = None):
|
|
159
378
|
if ctx:
|
|
160
|
-
full_url = f"https://{self.network}/
|
|
379
|
+
full_url = f"https://{self.network}/api/delete_from_ctx/{ctx}"
|
|
161
380
|
else:
|
|
162
|
-
full_url = f"https://{self.network}/delete"
|
|
163
|
-
|
|
164
|
-
print(f"Full URL: {full_url}")
|
|
381
|
+
full_url = f"https://{self.network}/api/delete"
|
|
165
382
|
|
|
166
383
|
delete = {
|
|
167
384
|
"label": label,
|
|
@@ -180,11 +397,9 @@ class Cell:
|
|
|
180
397
|
|
|
181
398
|
def clear(self, ctx: Optional[str] = None):
|
|
182
399
|
if ctx:
|
|
183
|
-
full_url = f"https://{self.network}/clear_ctx/{ctx}"
|
|
400
|
+
full_url = f"https://{self.network}/api/clear_ctx/{ctx}"
|
|
184
401
|
else:
|
|
185
|
-
full_url = f"https://{self.network}/clear"
|
|
186
|
-
|
|
187
|
-
print(f"Full URL: {full_url}")
|
|
402
|
+
full_url = f"https://{self.network}/api/clear"
|
|
188
403
|
|
|
189
404
|
clear = {
|
|
190
405
|
"cell": self.to_dict()
|
|
@@ -240,48 +455,35 @@ class Cell:
|
|
|
240
455
|
"password": self.password,
|
|
241
456
|
"synapse": self.synapse,
|
|
242
457
|
}
|
|
243
|
-
ws = None
|
|
244
458
|
|
|
245
459
|
try:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
ws.settimeout(1)
|
|
250
|
-
ws.send(json.dumps(auth))
|
|
251
|
-
print("Stream connection set...")
|
|
460
|
+
ws = create_connection(f"wss://{self.network}/sync/{stx}")
|
|
461
|
+
ws.send(json.dumps(auth))
|
|
462
|
+
print("Stream connection set...")
|
|
252
463
|
|
|
464
|
+
try:
|
|
465
|
+
while True:
|
|
253
466
|
try:
|
|
254
467
|
raw_operation = ws.recv()
|
|
255
468
|
operation = json.loads(raw_operation)
|
|
256
469
|
print("Listening to Stream...")
|
|
257
470
|
yield operation
|
|
258
471
|
|
|
259
|
-
ws.settimeout(None)
|
|
260
|
-
|
|
261
|
-
while True:
|
|
262
|
-
raw_operation = ws.recv()
|
|
263
|
-
operation = json.loads(raw_operation)
|
|
264
|
-
yield operation
|
|
265
472
|
except socket.timeout:
|
|
266
|
-
print("No initial data received.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
finally:
|
|
278
|
-
if ws:
|
|
279
|
-
ws.close()
|
|
280
|
-
print("Connection closed.")
|
|
473
|
+
print("No initial data received. Continuing to listen...")
|
|
474
|
+
continue
|
|
475
|
+
|
|
476
|
+
except KeyboardInterrupt:
|
|
477
|
+
print("Stream-Synchronization ended!")
|
|
478
|
+
except Exception as e:
|
|
479
|
+
print(f"Error: {e}")
|
|
480
|
+
finally:
|
|
481
|
+
ws.close()
|
|
482
|
+
print("Connection closed.")
|
|
483
|
+
|
|
281
484
|
except KeyboardInterrupt:
|
|
282
485
|
print("Stream-Synchronization ended!")
|
|
283
|
-
|
|
284
|
-
ws.close()
|
|
486
|
+
ws.close()
|
|
285
487
|
print("Connection closed. Goodbye!")
|
|
286
488
|
|
|
287
489
|
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: neuronum
|
|
3
|
+
Version: 1.5.0
|
|
4
|
+
Summary: Interact with the Neuronum Network to build & automate interconnected networks of soft- and hardware components
|
|
5
|
+
Home-page: https://neuronum.net
|
|
6
|
+
Author: Neuronum Cybernetics
|
|
7
|
+
Author-email: welcome@neuronum.net
|
|
8
|
+
Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: requests
|
|
16
|
+
Requires-Dist: websocket-client
|
|
17
|
+
Requires-Dist: iota-sdk
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
[](https://neuronum.net)
|
|
22
|
+
[](https://github.com/neuronumcybernetics/neuronum)
|
|
23
|
+
[](https://www.youtube.com/@neuronumnet)
|
|
24
|
+
|
|
25
|
+
`Neuronum` is a cybernetic framework enabling businesses to build & automate interconnected networks of soft- and hardware components
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
- **Cell**: Identity to connect and interact with the Neuronum Network
|
|
29
|
+
- **Transmitters (TX)**: Automate economic data transfer and storage
|
|
30
|
+
- **Circuits (CTX)**: Store data in a Key-Value-Label database
|
|
31
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
32
|
+
- **Nodes**: Soft-/Hardware components participating in the Network ecosystem
|
|
33
|
+
|
|
34
|
+
To interact with the Network you will need to create a Neuronum Cell.
|
|
35
|
+
Create your Cell: [Create Cell](https://neuronum.net/createcell)
|
|
36
|
+
|
|
37
|
+
Start with installing the Neuronum library using pip:
|
|
38
|
+
```python
|
|
39
|
+
pip install neuronum
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Configure and test Cell connection:
|
|
43
|
+
```python
|
|
44
|
+
import neuronum
|
|
45
|
+
|
|
46
|
+
cell = neuronum.Cell(
|
|
47
|
+
host="host::cell", # cell host
|
|
48
|
+
password="your_password", # cell password
|
|
49
|
+
network="neuronum.net", # cell network
|
|
50
|
+
synapse="your_synapse" # cell synapse
|
|
51
|
+
)
|
|
52
|
+
cell.connect() # connect to network
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Transmitters (TX)
|
|
56
|
+
Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format. Data sent with TX is always and automatically stored in a predefined Circuit (CTX)
|
|
57
|
+
|
|
58
|
+
Create Transmitter (TX):
|
|
59
|
+
```python
|
|
60
|
+
descr = "Test Transmitter" # description (max 25 characters)
|
|
61
|
+
key_values = { # defined keys and example values
|
|
62
|
+
"key1": "value1",
|
|
63
|
+
"key2": "value2",
|
|
64
|
+
"key3": "value3",
|
|
65
|
+
}
|
|
66
|
+
ctx = "id::ctx" # select Circuit (CTX)
|
|
67
|
+
label = "key1:key2" # label TX data
|
|
68
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
69
|
+
txID = cell.create_tx(descr, key_values, ctx, label, partners)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Activate Transmitter (TX):
|
|
73
|
+
```python
|
|
74
|
+
TX = "id::tx" # select Transmitter (TX)
|
|
75
|
+
data = { # enter key-values
|
|
76
|
+
"key1": "value1",
|
|
77
|
+
"key2": "value2",
|
|
78
|
+
"key3": "value3",
|
|
79
|
+
}
|
|
80
|
+
cell.activate_tx(TX, data) # activate TX
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Delete Transmitter (TX):
|
|
84
|
+
```python
|
|
85
|
+
TX = "id::tx" # select Transmitter (TX)
|
|
86
|
+
cell.delete_tx(TX) # delete TX
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
List Transmitter (TX) from Cell:
|
|
90
|
+
```python
|
|
91
|
+
cellID = "id::cell" # select Cell
|
|
92
|
+
txList = cell.list_tx(cellID) # list Transmitters (TX)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Circuits (CTX)
|
|
96
|
+
Circuits (CTX) store and organize data sent via Transmitters (TX) using a Key-Value-Label system
|
|
97
|
+
|
|
98
|
+
Create Circuit (CTX):
|
|
99
|
+
```python
|
|
100
|
+
descr = "Test Circuit" # description (max 25 characters)
|
|
101
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
102
|
+
ctxID = cell.create_ctx(descr, partners) # create Circuit (CTX)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Store data on your private Circuit (CTX):
|
|
106
|
+
```python
|
|
107
|
+
label = "your_label" # data label (should be unique)
|
|
108
|
+
data = { # data as key-value pairs
|
|
109
|
+
"key1": "value1",
|
|
110
|
+
"key2": "value2",
|
|
111
|
+
"key3": "value3",
|
|
112
|
+
}
|
|
113
|
+
cell.store(label, data) # store data
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Store data on a public Circuit (CTX):
|
|
117
|
+
```python
|
|
118
|
+
CTX = "id::ctx" # select Circuit (CTX
|
|
119
|
+
label = "your_label" # data label (should be unique)
|
|
120
|
+
data = { # data as key-value pairs
|
|
121
|
+
"key1": "value1",
|
|
122
|
+
"key2": "value2",
|
|
123
|
+
"key3": "value3",
|
|
124
|
+
}
|
|
125
|
+
cell.store(label, data, CTX) # store data
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Load data from your private Circuit (CTX):
|
|
129
|
+
```python
|
|
130
|
+
label = "your_label" # select label
|
|
131
|
+
data = cell.load(label) # load data by label
|
|
132
|
+
key1 = data["key1"] # get data from key
|
|
133
|
+
key2 = data["key2"]
|
|
134
|
+
key3 = data["key3"]
|
|
135
|
+
print(key1, key2, key3) # print data
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Load data from a public Circuit (CTX):
|
|
139
|
+
```python
|
|
140
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
141
|
+
label = "your_label" # select label
|
|
142
|
+
data = cell.load(label, CTX) # load data by label
|
|
143
|
+
key1 = data["key1"] # get data from key
|
|
144
|
+
key2 = data["key2"]
|
|
145
|
+
key3 = data["key3"]
|
|
146
|
+
print(key1, key2, key3) # print data
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Delete data from your private Circuit (CTX):
|
|
150
|
+
```python
|
|
151
|
+
label = "your_label" # select label
|
|
152
|
+
cell.delete(label) # delete data by label
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Delete data from a public Circuit (CTX):
|
|
156
|
+
```python
|
|
157
|
+
CTX = "id::ctx" # select Circuits (CTX)
|
|
158
|
+
label = "your_label" # select label
|
|
159
|
+
cell.delete(label, CTX) # delete data by label
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Clear your private Circuit (CTX):
|
|
163
|
+
```python
|
|
164
|
+
cell.clear() # clear Circuit (CTX)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Clear Circuit (CTX):
|
|
168
|
+
```python
|
|
169
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
170
|
+
cell.clear(CTX) # clear CTX
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Delete Circuit (CTX):
|
|
174
|
+
```python
|
|
175
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
176
|
+
cell.delete_ctx(CTX) # delete CTX
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
List Circuits (CTX) from Cell:
|
|
180
|
+
```python
|
|
181
|
+
cellID = "id::cell" # select Cell
|
|
182
|
+
ctxList = cell.list_ctx(cellID) # list Circuits (CTX)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Streams (STX)
|
|
186
|
+
Streams (STX) facilitate real-time data synchronization and interaction, ensuring real-time connectivity between Nodes in the Neuronum network
|
|
187
|
+
|
|
188
|
+
Create Stream (STX):
|
|
189
|
+
```python
|
|
190
|
+
descr = "Test Stream" # description (max 25 characters)
|
|
191
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
192
|
+
stxID = cell.create_stx(descr, partners) # create Stream (STX)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Stream data to your private Stream (STX):
|
|
196
|
+
```python
|
|
197
|
+
label = "your_label" # data label
|
|
198
|
+
data = { # data as key-value pairs
|
|
199
|
+
"key1": "value1",
|
|
200
|
+
"key2": "value2",
|
|
201
|
+
"key3": "value3",
|
|
202
|
+
}
|
|
203
|
+
cell.stream(label, data) # stream data
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Stream data to a public Stream (STX):
|
|
207
|
+
```python
|
|
208
|
+
STX = "id::stx" # select Stream (STX)
|
|
209
|
+
label = "your_label" # data label
|
|
210
|
+
data = { # data as key-value pairs
|
|
211
|
+
"key1": "value1",
|
|
212
|
+
"key2": "value2",
|
|
213
|
+
"key3": "value3",
|
|
214
|
+
}
|
|
215
|
+
cell.stream(label, data, STX) # stream data
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Sync data from your private Stream (STX):
|
|
219
|
+
```python
|
|
220
|
+
stream = cell.sync() # synchronize Stream (STX)
|
|
221
|
+
for operation in stream: # load stream operations
|
|
222
|
+
label = operation.get("label") # get the operation details by key
|
|
223
|
+
key1 = operation.get("data").get("key1")
|
|
224
|
+
key2 = operation.get("data").get("key2")
|
|
225
|
+
key3 = operation.get("data").get("key3")
|
|
226
|
+
ts = operation.get("time")
|
|
227
|
+
stxID = operation.get("stxID")
|
|
228
|
+
operator = operation.get("operator")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Sync data from a public Stream (STX):
|
|
232
|
+
```python
|
|
233
|
+
STX = "id::stx" # select Stream (STX)
|
|
234
|
+
stream = cell.sync(STX) # synchronize Stream (STX)
|
|
235
|
+
for operation in stream: # load stream operations
|
|
236
|
+
label = operation.get("label") # get the operation details by key
|
|
237
|
+
key1 = operation.get("data").get("key1")
|
|
238
|
+
key2 = operation.get("data").get("key2")
|
|
239
|
+
key3 = operation.get("data").get("key3")
|
|
240
|
+
ts = operation.get("time")
|
|
241
|
+
stxID = operation.get("stxID")
|
|
242
|
+
operator = operation.get("operator")
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
List Streams (STX) from Cell:
|
|
246
|
+
```python
|
|
247
|
+
cellID = "id::cell" # select Cell
|
|
248
|
+
stxList = cell.list_stx(cellID) # list Streams (STX)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Nodes
|
|
252
|
+
Neuronum Nodes are computing hardware running the Neuronum Client Library, enabling seamless data transmission, synchronization, and facilitating public Stream (STX) access
|
|
253
|
+
|
|
254
|
+
Register a Node with its associated Stream (STX):
|
|
255
|
+
```python
|
|
256
|
+
descr = "node_name" # description (max 25 characters)
|
|
257
|
+
mode = "public" # "public" or "private" Node
|
|
258
|
+
STX = "id::stx" # select Stream (STX)
|
|
259
|
+
nodeID = cell.register_node(descr, mode, STX) # register Node
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Delete Node:
|
|
263
|
+
```python
|
|
264
|
+
nodeID = "id::node" # select Node
|
|
265
|
+
cell.delete_node(nodeID) # delete Node
|
|
266
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
|
|
2
|
+
neuronum/neuronum.py,sha256=BymDHznUPI3mD09mquEbVODFMWiBaxNHYOst4-qDxZ8,14363
|
|
3
|
+
neuronum-1.5.0.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
|
|
4
|
+
neuronum-1.5.0.dist-info/METADATA,sha256=9s6uAwEgWSVAM0FwIwayvuskht2myPMUeGXEMgxV8ew,11764
|
|
5
|
+
neuronum-1.5.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
+
neuronum-1.5.0.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
|
|
7
|
+
neuronum-1.5.0.dist-info/RECORD,,
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: neuronum
|
|
3
|
-
Version: 1.4.1
|
|
4
|
-
Summary: Interact with the Neuronum Network to build, connect & automate real-time data streams
|
|
5
|
-
Home-page: https://neuronum.net
|
|
6
|
-
Author: Neuronum Cybernetics
|
|
7
|
-
Author-email: welcome@neuronum.net
|
|
8
|
-
Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.6
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: requests
|
|
16
|
-
Requires-Dist: websocket-client
|
|
17
|
-
|
|
18
|
-

|
|
19
|
-
|
|
20
|
-
[](https://neuronum.net)
|
|
21
|
-
[](https://github.com/neuronumcybernetics/neuronum)
|
|
22
|
-
[](https://www.youtube.com/@neuronumnet)
|
|
23
|
-
|
|
24
|
-
Interact with the `Neuronum Network` to build, connect & automate real-time data streams.
|
|
25
|
-
|
|
26
|
-
## Cell Features
|
|
27
|
-
- **Transmitters (TX)**: Automate economic data transfer + Circuits Integration
|
|
28
|
-
- **Circuits (CTX)**: A simple Key-Value-Label database to store economic data
|
|
29
|
-
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
30
|
-
- **Nodes**: Register hardware nodes actively streaming real-time data into the network
|
|
31
|
-
|
|
32
|
-
## Getting Started
|
|
33
|
-
Create your Neuronum Cell: [Create Cell](https://neuronum.net/createcell)
|
|
34
|
-
|
|
35
|
-
Install the Neuronum library using pip:
|
|
36
|
-
```bash
|
|
37
|
-
pip install neuronum
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Set and test Cell connection:
|
|
41
|
-
```bash
|
|
42
|
-
import neuronum
|
|
43
|
-
|
|
44
|
-
cell = neuronum.Cell(
|
|
45
|
-
host="host::cell",
|
|
46
|
-
password="your_password",
|
|
47
|
-
network="neuronum.net",
|
|
48
|
-
synapse="your_synapse"
|
|
49
|
-
)
|
|
50
|
-
cell.test_connection()
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Transmitters (TX)
|
|
54
|
-
Activate Transmitter (TX):
|
|
55
|
-
```bash
|
|
56
|
-
TX = "id::tx"
|
|
57
|
-
data = {
|
|
58
|
-
"key1": "value1",
|
|
59
|
-
"key2": "value2",
|
|
60
|
-
"key3": "value3",
|
|
61
|
-
}
|
|
62
|
-
cell.activate(TX, data)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Circuits (CTX)
|
|
66
|
-
Store data on your private Circuit (CTX):
|
|
67
|
-
```bash
|
|
68
|
-
label = "your_label"
|
|
69
|
-
data = {
|
|
70
|
-
"key1": "value1",
|
|
71
|
-
"key2": "value2",
|
|
72
|
-
"key3": "value3",
|
|
73
|
-
}
|
|
74
|
-
cell.store(label, data)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Store data on a public Circuit (CTX):
|
|
78
|
-
```bash
|
|
79
|
-
CTX = "id::ctx"
|
|
80
|
-
label = "your_label"
|
|
81
|
-
data = {
|
|
82
|
-
"key1": "value1",
|
|
83
|
-
"key2": "value2",
|
|
84
|
-
"key3": "value3",
|
|
85
|
-
}
|
|
86
|
-
cell.store(label, data, CTX)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Load data from your private Circuit (CTX):
|
|
90
|
-
```bash
|
|
91
|
-
label = "your_label"
|
|
92
|
-
data = cell.load(label)
|
|
93
|
-
key1 = data["key1"]
|
|
94
|
-
key2 = data["key2"]
|
|
95
|
-
key3 = data["key3"]
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Load data from a public Circuit (CTX):
|
|
99
|
-
```bash
|
|
100
|
-
CTX = "id::ctx"
|
|
101
|
-
label = "your_label"
|
|
102
|
-
data = cell.load(label, CTX)
|
|
103
|
-
key1 = data["key1"]
|
|
104
|
-
key2 = data["key2"]
|
|
105
|
-
key3 = data["key3"]
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Delete data from your private Circuit (CTX):
|
|
109
|
-
```bash
|
|
110
|
-
label = "your_label"
|
|
111
|
-
data = cell.delete(label)
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Delete data from a public Circuit (CTX):
|
|
115
|
-
```bash
|
|
116
|
-
CTX = "id::ctx"
|
|
117
|
-
label = "your_label"
|
|
118
|
-
data = cell.delete(label, CTX)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Empty your private Circuit (CTX):
|
|
122
|
-
```bash
|
|
123
|
-
cell.clear()
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Empty a public Circuit (CTX):
|
|
127
|
-
```bash
|
|
128
|
-
CTX = "id::ctx"
|
|
129
|
-
cell.clear(CTX)
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Streams (STX)
|
|
133
|
-
Stream data to your private Stream (STX):
|
|
134
|
-
```bash
|
|
135
|
-
label = "your_label"
|
|
136
|
-
data = {
|
|
137
|
-
"key1": "value1",
|
|
138
|
-
"key2": "value2",
|
|
139
|
-
"key3": "value3",
|
|
140
|
-
}
|
|
141
|
-
cell.stream(label, data)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Stream data to a public Stream (STX):
|
|
145
|
-
```bash
|
|
146
|
-
STX = "id::stx"
|
|
147
|
-
label = "your_label"
|
|
148
|
-
data = {
|
|
149
|
-
"key1": "value1",
|
|
150
|
-
"key2": "value2",
|
|
151
|
-
"key3": "value3",
|
|
152
|
-
}
|
|
153
|
-
cell.stream(label, data, STX)
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Sync data from your private Stream (STX):
|
|
157
|
-
```bash
|
|
158
|
-
stream = cell.sync()
|
|
159
|
-
for operation in stream:
|
|
160
|
-
label = operation.get("label")
|
|
161
|
-
value = operation.get("data").get("key1")
|
|
162
|
-
ts = operation.get("time")
|
|
163
|
-
stxID = operation.get("stxID")
|
|
164
|
-
operator = operation.get("operator")
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Sync data from a public Stream (STX):
|
|
168
|
-
```bash
|
|
169
|
-
STX = "id::stx"
|
|
170
|
-
stream = cell.sync(STX)
|
|
171
|
-
for operation in stream:
|
|
172
|
-
label = operation.get("label")
|
|
173
|
-
value = operation.get("data").get("key1")
|
|
174
|
-
ts = operation.get("time")
|
|
175
|
-
stxID = operation.get("stxID")
|
|
176
|
-
operator = operation.get("operator")
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Nodes
|
|
180
|
-
Register a public Node with its associated Stream (STX):
|
|
181
|
-
```bash
|
|
182
|
-
node = "node_name" # Unique node name
|
|
183
|
-
mode = "public"
|
|
184
|
-
STX = "id::stx"
|
|
185
|
-
cell.register(node, mode, STX)
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Register a private Node with its associated Stream (STX):
|
|
189
|
-
```bash
|
|
190
|
-
node = "node_name" # Unique node name
|
|
191
|
-
mode = "private"
|
|
192
|
-
STX = "id::stx"
|
|
193
|
-
cell.register(node, mode, STX)
|
|
194
|
-
```
|
|
195
|
-
|
neuronum-1.4.1.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
|
|
2
|
-
neuronum/neuronum.py,sha256=X5peM3ZOK7MJU-zS8GeqBC2vBu-weAJgCfzQ48I3FvI,8908
|
|
3
|
-
neuronum-1.4.1.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
|
|
4
|
-
neuronum-1.4.1.dist-info/METADATA,sha256=lg-qZ407i0vZsj4BNVR7X8_keos82I4r7pnzMVjwjwc,4590
|
|
5
|
-
neuronum-1.4.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
-
neuronum-1.4.1.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
|
|
7
|
-
neuronum-1.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|