neuronum 1.2.2__tar.gz → 1.2.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.2.2 → neuronum-1.2.4}/PKG-INFO +8 -1
- {neuronum-1.2.2 → neuronum-1.2.4}/README.md +7 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum/neuronum.py +32 -31
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum.egg-info/PKG-INFO +8 -1
- {neuronum-1.2.2 → neuronum-1.2.4}/setup.py +1 -1
- {neuronum-1.2.2 → neuronum-1.2.4}/LICENSE +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum/__init__.py +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum.egg-info/SOURCES.txt +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum.egg-info/dependency_links.txt +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum.egg-info/requires.txt +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/neuronum.egg-info/top_level.txt +0 -0
- {neuronum-1.2.2 → neuronum-1.2.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.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
|
|
@@ -136,5 +136,12 @@ cell.stream(label, data)
|
|
|
136
136
|
Sync stream:
|
|
137
137
|
```bash
|
|
138
138
|
stream = cell.sync()
|
|
139
|
+
for operation in stream:
|
|
140
|
+
label = operation.get("label")
|
|
141
|
+
data = operation.get("data")
|
|
142
|
+
key = operation.get("data").get("key1")
|
|
143
|
+
time = operation.get("time")
|
|
144
|
+
stxID = operation.get("stxID")
|
|
145
|
+
operator = operation.get("cellHost")
|
|
139
146
|
```
|
|
140
147
|
|
|
@@ -119,5 +119,12 @@ cell.stream(label, data)
|
|
|
119
119
|
Sync stream:
|
|
120
120
|
```bash
|
|
121
121
|
stream = cell.sync()
|
|
122
|
+
for operation in stream:
|
|
123
|
+
label = operation.get("label")
|
|
124
|
+
data = operation.get("data")
|
|
125
|
+
key = operation.get("data").get("key1")
|
|
126
|
+
time = operation.get("time")
|
|
127
|
+
stxID = operation.get("stxID")
|
|
128
|
+
operator = operation.get("cellHost")
|
|
122
129
|
```
|
|
123
130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
import socket
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Optional, Generator
|
|
4
4
|
import ssl
|
|
5
5
|
from websocket import create_connection
|
|
6
6
|
from typing import List
|
|
@@ -207,37 +207,38 @@ class Cell:
|
|
|
207
207
|
return "Authentication successful" in response
|
|
208
208
|
|
|
209
209
|
|
|
210
|
-
def sync(self, stx: Optional[str] = None) ->
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
ws = create_connection(f"wss://{self.network}/sync/{stx}")
|
|
220
|
-
ws.settimeout(1)
|
|
221
|
-
print(f"Auth Payload: {auth}")
|
|
222
|
-
ws.send(json.dumps(auth))
|
|
223
|
-
|
|
224
|
-
except Exception as e:
|
|
225
|
-
print(f"Failed to connect: {e}")
|
|
226
|
-
return stream
|
|
210
|
+
def sync(self, stx: Optional[str] = None) -> Generator[str, None, None]:
|
|
211
|
+
auth = {
|
|
212
|
+
"host": self.host,
|
|
213
|
+
"password": self.password,
|
|
214
|
+
"synapse": self.synapse,
|
|
215
|
+
}
|
|
216
|
+
print(f"Auth Payload: {auth}")
|
|
227
217
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
218
|
+
while True:
|
|
219
|
+
try:
|
|
220
|
+
ws = create_connection(f"wss://{self.network}/sync/{stx}")
|
|
221
|
+
ws.settimeout(1)
|
|
222
|
+
ws.send(json.dumps(auth))
|
|
223
|
+
print("Connected to WebSocket.")
|
|
224
|
+
|
|
225
|
+
while True:
|
|
226
|
+
try:
|
|
227
|
+
raw_operation = ws.recv()
|
|
228
|
+
operation = json.loads(raw_operation)
|
|
229
|
+
yield operation
|
|
230
|
+
except socket.timeout:
|
|
231
|
+
print("Timeout occurred, no data received.")
|
|
232
|
+
except KeyboardInterrupt:
|
|
233
|
+
print("Closing connection...")
|
|
234
|
+
ws.close()
|
|
235
|
+
return
|
|
236
|
+
except Exception as e:
|
|
237
|
+
print(f"Connection failed: {e}")
|
|
238
|
+
finally:
|
|
239
|
+
if ws:
|
|
240
|
+
ws.close()
|
|
241
|
+
print("Connection closed, retrying...")
|
|
240
242
|
|
|
241
|
-
return stream
|
|
242
243
|
|
|
243
244
|
__all__ = ['Cell']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.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
|
|
@@ -136,5 +136,12 @@ cell.stream(label, data)
|
|
|
136
136
|
Sync stream:
|
|
137
137
|
```bash
|
|
138
138
|
stream = cell.sync()
|
|
139
|
+
for operation in stream:
|
|
140
|
+
label = operation.get("label")
|
|
141
|
+
data = operation.get("data")
|
|
142
|
+
key = operation.get("data").get("key1")
|
|
143
|
+
time = operation.get("time")
|
|
144
|
+
stxID = operation.get("stxID")
|
|
145
|
+
operator = operation.get("cellHost")
|
|
139
146
|
```
|
|
140
147
|
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='neuronum',
|
|
5
|
-
version='1.2.
|
|
5
|
+
version='1.2.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
|