neuronum 1.3.0__tar.gz → 1.3.2__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.0 → neuronum-1.3.2}/PKG-INFO +27 -3
- {neuronum-1.3.0 → neuronum-1.3.2}/README.md +26 -2
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum/neuronum.py +21 -19
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum.egg-info/PKG-INFO +27 -3
- {neuronum-1.3.0 → neuronum-1.3.2}/setup.py +1 -1
- {neuronum-1.3.0 → neuronum-1.3.2}/LICENSE +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum/__init__.py +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum.egg-info/SOURCES.txt +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum.egg-info/dependency_links.txt +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum.egg-info/requires.txt +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/neuronum.egg-info/top_level.txt +0 -0
- {neuronum-1.3.0 → neuronum-1.3.2}/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.2
|
|
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
|
|
@@ -133,7 +133,7 @@ cell.clear(CTX)
|
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Streams (STX)
|
|
136
|
-
Stream data:
|
|
136
|
+
Stream data to your private Stream (STX):
|
|
137
137
|
```bash
|
|
138
138
|
label = "your_label"
|
|
139
139
|
data = {
|
|
@@ -144,7 +144,19 @@ data = {
|
|
|
144
144
|
cell.stream(label, data)
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
Stream data to a public Stream (STX):
|
|
148
|
+
```bash
|
|
149
|
+
STX = "id::stx"
|
|
150
|
+
label = "your_label"
|
|
151
|
+
data = {
|
|
152
|
+
"key1": "value1",
|
|
153
|
+
"key2": "value2",
|
|
154
|
+
"key3": "value3",
|
|
155
|
+
}
|
|
156
|
+
cell.stream(label, data, STX)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Sync data from your private Stream (STX):
|
|
148
160
|
```bash
|
|
149
161
|
stream = cell.sync()
|
|
150
162
|
for operation in stream:
|
|
@@ -155,3 +167,15 @@ for operation in stream:
|
|
|
155
167
|
operator = operation.get("operator")
|
|
156
168
|
```
|
|
157
169
|
|
|
170
|
+
Sync data from a public Stream (STX):
|
|
171
|
+
```bash
|
|
172
|
+
STX = "id::stx"
|
|
173
|
+
stream = cell.sync(STX)
|
|
174
|
+
for operation in stream:
|
|
175
|
+
label = operation.get("label")
|
|
176
|
+
value = operation.get("data").get("key1")
|
|
177
|
+
ts = operation.get("time")
|
|
178
|
+
stxID = operation.get("stxID")
|
|
179
|
+
operator = operation.get("operator")
|
|
180
|
+
```
|
|
181
|
+
|
|
@@ -116,7 +116,7 @@ cell.clear(CTX)
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
### Streams (STX)
|
|
119
|
-
Stream data:
|
|
119
|
+
Stream data to your private Stream (STX):
|
|
120
120
|
```bash
|
|
121
121
|
label = "your_label"
|
|
122
122
|
data = {
|
|
@@ -127,7 +127,19 @@ data = {
|
|
|
127
127
|
cell.stream(label, data)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
Stream data to a public Stream (STX):
|
|
131
|
+
```bash
|
|
132
|
+
STX = "id::stx"
|
|
133
|
+
label = "your_label"
|
|
134
|
+
data = {
|
|
135
|
+
"key1": "value1",
|
|
136
|
+
"key2": "value2",
|
|
137
|
+
"key3": "value3",
|
|
138
|
+
}
|
|
139
|
+
cell.stream(label, data, STX)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Sync data from your private Stream (STX):
|
|
131
143
|
```bash
|
|
132
144
|
stream = cell.sync()
|
|
133
145
|
for operation in stream:
|
|
@@ -138,3 +150,15 @@ for operation in stream:
|
|
|
138
150
|
operator = operation.get("operator")
|
|
139
151
|
```
|
|
140
152
|
|
|
153
|
+
Sync data from a public Stream (STX):
|
|
154
|
+
```bash
|
|
155
|
+
STX = "id::stx"
|
|
156
|
+
stream = cell.sync(STX)
|
|
157
|
+
for operation in stream:
|
|
158
|
+
label = operation.get("label")
|
|
159
|
+
value = operation.get("data").get("key1")
|
|
160
|
+
ts = operation.get("time")
|
|
161
|
+
stxID = operation.get("stxID")
|
|
162
|
+
operator = operation.get("operator")
|
|
163
|
+
```
|
|
164
|
+
|
|
@@ -24,6 +24,16 @@ class Cell:
|
|
|
24
24
|
|
|
25
25
|
def __repr__(self) -> str:
|
|
26
26
|
return f"Cell(host={self.host}, password={self.password}, network={self.network}, synapse={self.synapse})"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def authenticate(self, stx: Optional[str] = None):
|
|
30
|
+
credentials = f"{self.host}\n{self.password}\n{self.synapse}\n{stx}\n"
|
|
31
|
+
self.sock.sendall(credentials.encode('utf-8'))
|
|
32
|
+
|
|
33
|
+
response = self.sock.recv(1024).decode('utf-8')
|
|
34
|
+
print(response)
|
|
35
|
+
return "Authentication successful" in response
|
|
36
|
+
|
|
27
37
|
|
|
28
38
|
def activate(self, txID: str, data: dict):
|
|
29
39
|
url = f"https://{self.network}/activateTX/{txID}"
|
|
@@ -161,29 +171,31 @@ class Cell:
|
|
|
161
171
|
|
|
162
172
|
|
|
163
173
|
def stream(self, label: str, data: dict, stx: Optional[str] = None):
|
|
174
|
+
"""Stream data after authenticating once."""
|
|
164
175
|
context = ssl.create_default_context()
|
|
165
176
|
context.check_hostname = True
|
|
166
177
|
context.verify_mode = ssl.CERT_REQUIRED
|
|
178
|
+
|
|
167
179
|
raw_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
168
180
|
self.sock = context.wrap_socket(raw_sock, server_hostname=self.network)
|
|
169
181
|
|
|
170
182
|
print("SSL socket set")
|
|
171
183
|
|
|
172
184
|
try:
|
|
173
|
-
|
|
174
|
-
stream = {
|
|
175
|
-
"label": label,
|
|
176
|
-
"data": data,
|
|
177
|
-
}
|
|
178
|
-
|
|
179
185
|
print(f"Connecting to {self.network}")
|
|
180
186
|
self.sock.connect((self.network, 55555))
|
|
181
187
|
print("SSL socket connected")
|
|
182
188
|
|
|
183
|
-
if not self.authenticate(
|
|
189
|
+
if not self.authenticate(stx):
|
|
184
190
|
print("Authentication failed. Cannot stream.")
|
|
185
191
|
return
|
|
186
192
|
|
|
193
|
+
# Stream data
|
|
194
|
+
stream = {
|
|
195
|
+
"label": label,
|
|
196
|
+
"data": data,
|
|
197
|
+
}
|
|
198
|
+
|
|
187
199
|
self.sock.sendall(json.dumps(stream).encode('utf-8'))
|
|
188
200
|
print(f"Sent: {stream}")
|
|
189
201
|
|
|
@@ -197,16 +209,6 @@ class Cell:
|
|
|
197
209
|
self.sock.close()
|
|
198
210
|
print("SSL connection closed.")
|
|
199
211
|
|
|
200
|
-
|
|
201
|
-
def authenticate(self, sock, stx: Optional[str] = None):
|
|
202
|
-
credentials = f"{self.host}\n{self.password}\n{self.synapse}\n{stx}\n"
|
|
203
|
-
sock.sendall(credentials.encode('utf-8'))
|
|
204
|
-
|
|
205
|
-
response = sock.recv(1024).decode('utf-8')
|
|
206
|
-
print(response)
|
|
207
|
-
return "Authentication successful" in response
|
|
208
|
-
|
|
209
|
-
|
|
210
212
|
def sync(self, stx: Optional[str] = None) -> Generator[str, None, None]:
|
|
211
213
|
auth = {
|
|
212
214
|
"host": self.host,
|
|
@@ -218,7 +220,7 @@ class Cell:
|
|
|
218
220
|
while True:
|
|
219
221
|
try:
|
|
220
222
|
ws = create_connection(f"wss://{self.network}/sync/{stx}")
|
|
221
|
-
ws.settimeout(
|
|
223
|
+
ws.settimeout(10)
|
|
222
224
|
ws.send(json.dumps(auth))
|
|
223
225
|
print("Connected to WebSocket.")
|
|
224
226
|
|
|
@@ -228,7 +230,7 @@ class Cell:
|
|
|
228
230
|
operation = json.loads(raw_operation)
|
|
229
231
|
yield operation
|
|
230
232
|
except socket.timeout:
|
|
231
|
-
print("
|
|
233
|
+
print("Waiting for stream...")
|
|
232
234
|
except KeyboardInterrupt:
|
|
233
235
|
print("Closing connection...")
|
|
234
236
|
ws.close()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
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
|
|
@@ -133,7 +133,7 @@ cell.clear(CTX)
|
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Streams (STX)
|
|
136
|
-
Stream data:
|
|
136
|
+
Stream data to your private Stream (STX):
|
|
137
137
|
```bash
|
|
138
138
|
label = "your_label"
|
|
139
139
|
data = {
|
|
@@ -144,7 +144,19 @@ data = {
|
|
|
144
144
|
cell.stream(label, data)
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
Stream data to a public Stream (STX):
|
|
148
|
+
```bash
|
|
149
|
+
STX = "id::stx"
|
|
150
|
+
label = "your_label"
|
|
151
|
+
data = {
|
|
152
|
+
"key1": "value1",
|
|
153
|
+
"key2": "value2",
|
|
154
|
+
"key3": "value3",
|
|
155
|
+
}
|
|
156
|
+
cell.stream(label, data, STX)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Sync data from your private Stream (STX):
|
|
148
160
|
```bash
|
|
149
161
|
stream = cell.sync()
|
|
150
162
|
for operation in stream:
|
|
@@ -155,3 +167,15 @@ for operation in stream:
|
|
|
155
167
|
operator = operation.get("operator")
|
|
156
168
|
```
|
|
157
169
|
|
|
170
|
+
Sync data from a public Stream (STX):
|
|
171
|
+
```bash
|
|
172
|
+
STX = "id::stx"
|
|
173
|
+
stream = cell.sync(STX)
|
|
174
|
+
for operation in stream:
|
|
175
|
+
label = operation.get("label")
|
|
176
|
+
value = operation.get("data").get("key1")
|
|
177
|
+
ts = operation.get("time")
|
|
178
|
+
stxID = operation.get("stxID")
|
|
179
|
+
operator = operation.get("operator")
|
|
180
|
+
```
|
|
181
|
+
|
|
@@ -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.2',
|
|
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
|