neuronum 1.2.2__tar.gz → 1.2.3__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neuronum
3
- Version: 1.2.2
3
+ Version: 1.2.3
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
@@ -209,35 +209,38 @@ class Cell:
209
209
 
210
210
  def sync(self, stx: Optional[str] = None) -> List[str]:
211
211
  stream = []
212
- try:
213
- auth = {
214
- "host": self.host,
215
- "password": self.password,
216
- "synapse": self.synapse,
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
212
+ auth = {
213
+ "host": self.host,
214
+ "password": self.password,
215
+ "synapse": self.synapse,
216
+ }
217
+ print(f"Auth Payload: {auth}")
227
218
 
228
- try:
229
- while True:
230
- message = ws.recv()
231
- print(f"Received Data: {message}")
232
- stream.append(message)
233
- except KeyboardInterrupt:
234
- print("Closing connection...")
235
- except Exception as e:
236
- print(f"Error during data collection: {e}")
237
- finally:
238
- ws.close()
239
- print("Connection closed.")
219
+ while True:
220
+ try:
221
+ ws = create_connection(f"wss://{self.network}/sync/{stx}")
222
+ ws.settimeout(1) # Set timeout for receiving data
223
+ ws.send(json.dumps(auth))
224
+ print("Connected to WebSocket.")
225
+
226
+ while True:
227
+ try:
228
+ message = ws.recv()
229
+ print(f"Received Data: {message}")
230
+ stream.append(message)
231
+ except socket.timeout:
232
+ # Timeout occurred, but keep the connection open
233
+ print("Timeout occurred, no data received.")
234
+ except KeyboardInterrupt:
235
+ print("Closing connection...")
236
+ ws.close()
237
+ return stream
238
+ except Exception as e:
239
+ print(f"Connection failed: {e}")
240
+ finally:
241
+ if ws:
242
+ ws.close()
243
+ print("Connection closed, retrying...")
240
244
 
241
- return stream
242
245
 
243
246
  __all__ = ['Cell']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neuronum
3
- Version: 1.2.2
3
+ Version: 1.2.3
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='neuronum',
5
- version='1.2.2',
5
+ version='1.2.3',
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