neuronum 1.3.3__tar.gz → 1.3.4__tar.gz
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-1.3.3 → neuronum-1.3.4}/PKG-INFO +2 -2
- {neuronum-1.3.3 → neuronum-1.3.4}/README.md +1 -1
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum/neuronum.py +37 -27
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum.egg-info/PKG-INFO +2 -2
- {neuronum-1.3.3 → neuronum-1.3.4}/setup.py +1 -1
- {neuronum-1.3.3 → neuronum-1.3.4}/LICENSE +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum/__init__.py +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum.egg-info/SOURCES.txt +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum.egg-info/dependency_links.txt +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum.egg-info/requires.txt +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/neuronum.egg-info/top_level.txt +0 -0
- {neuronum-1.3.3 → neuronum-1.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: Interact with the Neuronum Network to build, connect & automate economic data streams
|
|
5
5
|
Home-page: https://neuronum.net
|
|
6
6
|
Author: Neuronum Cybernetics
|
|
@@ -26,7 +26,7 @@ Interact with the `Neuronum Network` to build, connect & automate economic data
|
|
|
26
26
|
## Cell Features
|
|
27
27
|
- **Transmitters (TX)**: Automate economic data transfer + Circuits Integration
|
|
28
28
|
- **Circuits (CTX)**: A simple Key-Value-Label database to store economic data
|
|
29
|
-
- **Streams (STX)**:
|
|
29
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
30
30
|
|
|
31
31
|
## Getting Started
|
|
32
32
|
Create your Neuronum Cell: [Create Cell](https://neuronum.net/createcell)
|
|
@@ -9,7 +9,7 @@ Interact with the `Neuronum Network` to build, connect & automate economic data
|
|
|
9
9
|
## Cell Features
|
|
10
10
|
- **Transmitters (TX)**: Automate economic data transfer + Circuits Integration
|
|
11
11
|
- **Circuits (CTX)**: A simple Key-Value-Label database to store economic data
|
|
12
|
-
- **Streams (STX)**:
|
|
12
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
13
13
|
|
|
14
14
|
## Getting Started
|
|
15
15
|
Create your Neuronum Cell: [Create Cell](https://neuronum.net/createcell)
|
|
@@ -3,7 +3,6 @@ import socket
|
|
|
3
3
|
from typing import Optional, Generator
|
|
4
4
|
import ssl
|
|
5
5
|
from websocket import create_connection
|
|
6
|
-
from typing import List
|
|
7
6
|
import json
|
|
8
7
|
|
|
9
8
|
|
|
@@ -169,9 +168,7 @@ class Cell:
|
|
|
169
168
|
print(f"Unexpected error: {e}")
|
|
170
169
|
|
|
171
170
|
|
|
172
|
-
|
|
173
171
|
def stream(self, label: str, data: dict, stx: Optional[str] = None):
|
|
174
|
-
"""Stream data after authenticating once."""
|
|
175
172
|
context = ssl.create_default_context()
|
|
176
173
|
context.check_hostname = True
|
|
177
174
|
context.verify_mode = ssl.CERT_REQUIRED
|
|
@@ -179,18 +176,14 @@ class Cell:
|
|
|
179
176
|
raw_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
180
177
|
self.sock = context.wrap_socket(raw_sock, server_hostname=self.network)
|
|
181
178
|
|
|
182
|
-
print("SSL socket set")
|
|
183
|
-
|
|
184
179
|
try:
|
|
185
180
|
print(f"Connecting to {self.network}")
|
|
186
181
|
self.sock.connect((self.network, 55555))
|
|
187
|
-
print("SSL socket connected")
|
|
188
182
|
|
|
189
183
|
if not self.authenticate(stx):
|
|
190
184
|
print("Authentication failed. Cannot stream.")
|
|
191
185
|
return
|
|
192
186
|
|
|
193
|
-
# Stream data
|
|
194
187
|
stream = {
|
|
195
188
|
"label": label,
|
|
196
189
|
"data": data,
|
|
@@ -207,7 +200,7 @@ class Cell:
|
|
|
207
200
|
|
|
208
201
|
finally:
|
|
209
202
|
self.sock.close()
|
|
210
|
-
|
|
203
|
+
|
|
211
204
|
|
|
212
205
|
def sync(self, stx: Optional[str] = None) -> Generator[str, None, None]:
|
|
213
206
|
auth = {
|
|
@@ -215,32 +208,49 @@ class Cell:
|
|
|
215
208
|
"password": self.password,
|
|
216
209
|
"synapse": self.synapse,
|
|
217
210
|
}
|
|
218
|
-
|
|
211
|
+
ws = None
|
|
219
212
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
try:
|
|
214
|
+
while True:
|
|
215
|
+
try:
|
|
216
|
+
ws = create_connection(f"wss://{self.network}/sync/{stx}")
|
|
217
|
+
ws.settimeout(1)
|
|
218
|
+
ws.send(json.dumps(auth))
|
|
219
|
+
print("Stream connection set...")
|
|
226
220
|
|
|
227
|
-
while True:
|
|
228
221
|
try:
|
|
229
222
|
raw_operation = ws.recv()
|
|
230
223
|
operation = json.loads(raw_operation)
|
|
224
|
+
print("Listening to Stream...")
|
|
231
225
|
yield operation
|
|
226
|
+
|
|
227
|
+
ws.settimeout(None)
|
|
228
|
+
|
|
229
|
+
while True:
|
|
230
|
+
raw_operation = ws.recv()
|
|
231
|
+
operation = json.loads(raw_operation)
|
|
232
|
+
yield operation
|
|
232
233
|
except socket.timeout:
|
|
233
|
-
print("
|
|
234
|
-
except KeyboardInterrupt:
|
|
235
|
-
print("Closing connection...")
|
|
234
|
+
print("No initial data received. Retrying connection...")
|
|
236
235
|
ws.close()
|
|
237
|
-
return
|
|
238
|
-
except Exception as e:
|
|
239
|
-
print(f"Connection failed: {e}")
|
|
240
|
-
finally:
|
|
241
|
-
if ws:
|
|
242
|
-
ws.close()
|
|
243
|
-
print("Connection closed, retrying...")
|
|
244
236
|
|
|
245
|
-
|
|
237
|
+
except KeyboardInterrupt:
|
|
238
|
+
print("Stream-Synchronization ended!")
|
|
239
|
+
if ws:
|
|
240
|
+
ws.close()
|
|
241
|
+
print("Connection closed. Exiting.")
|
|
242
|
+
return
|
|
243
|
+
except Exception as e:
|
|
244
|
+
print(f"{e}")
|
|
245
|
+
finally:
|
|
246
|
+
if ws:
|
|
247
|
+
ws.close()
|
|
248
|
+
print("Connection closed.")
|
|
249
|
+
except KeyboardInterrupt:
|
|
250
|
+
print("Stream-Synchronization ended!")
|
|
251
|
+
if ws:
|
|
252
|
+
ws.close()
|
|
253
|
+
print("Connection closed. Goodbye!")
|
|
254
|
+
|
|
255
|
+
|
|
246
256
|
__all__ = ['Cell']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: Interact with the Neuronum Network to build, connect & automate economic data streams
|
|
5
5
|
Home-page: https://neuronum.net
|
|
6
6
|
Author: Neuronum Cybernetics
|
|
@@ -26,7 +26,7 @@ Interact with the `Neuronum Network` to build, connect & automate economic data
|
|
|
26
26
|
## Cell Features
|
|
27
27
|
- **Transmitters (TX)**: Automate economic data transfer + Circuits Integration
|
|
28
28
|
- **Circuits (CTX)**: A simple Key-Value-Label database to store economic data
|
|
29
|
-
- **Streams (STX)**:
|
|
29
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
30
30
|
|
|
31
31
|
## Getting Started
|
|
32
32
|
Create your Neuronum Cell: [Create Cell](https://neuronum.net/createcell)
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='neuronum',
|
|
5
|
-
version='1.3.
|
|
5
|
+
version='1.3.4',
|
|
6
6
|
author='Neuronum Cybernetics',
|
|
7
7
|
author_email='welcome@neuronum.net',
|
|
8
8
|
description='Interact with the Neuronum Network to build, connect & automate economic data streams',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|