tomorrowdata / iottly-sdk-python Goto Github PK
View Code? Open in Web Editor NEWPython module handling interaction with the iottly agent
License: Apache License 2.0
Python module handling interaction with the iottly agent
License: Apache License 2.0
json.dumps raise a TypeError if there is a python object not JSON serializable inside the send payload.
iottly-sdk-python/iottly_sdk/iottly.py
Lines 227 to 230 in 835feab
Maybe we could add a new argument for the SDK init that gives a function to handle this objects.
This function could be provided to the json.dumps default argument.
Il problema รจ che si sta cercando di chiamare la call_agent da dentro la callback
on_agent_status_changed
.
Lacall_agent
verifica che l'agent abbia una versione compatibile (>=1.8).
Quando viene triggerata la callbackon_agent_status_changed("started")
, l'agent non ha ancora fatto in tempo a mandare la sua versione, quindi lacall_agent
non viene chiamata.
How to reproduce
>>> import iottly_sdk
>>> sdk = iottly_sdk.IottlySDK("Wilson")
>>> sdk.start()
>>> Exception in thread receiver_t:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.5/dist-packages/iottly_sdk-1.3.0-py3.5.egg/iottly_sdk/iottly.py", line 486, in _receive_msgs_from_agent
self._process_msg_from_agent(msg)
File "/usr/local/lib/python3.5/dist-packages/iottly_sdk-1.3.0-py3.5.egg/iottly_sdk/iottly.py", line 506, in _process_msg_from_agent
self._handle_signals_from_agent(msg['signal'])
File "/usr/local/lib/python3.5/dist-packages/iottly_sdk-1.3.0-py3.5.egg/iottly_sdk/iottly.py", line 519, in _handle_signals_from_agent
self._on_connection_status_changed_cb(status)
TypeError: 'NoneType' object is not callable
Cause
iottly-sdk-python/iottly_sdk/iottly.py
Lines 513 to 519 in 890a18b
iottly-sdk-python/iottly_sdk/iottly.py
Lines 550 to 551 in 890a18b
Thanks to @Oscar-Campo and @lupodellasleppa ๐๏ธ
When the SDK initializes, it gives no feedback as to if the start() has completed or not.
This could lead to third party applications considering the SDK as started, while in reality it's still starting.
It could happen, for example, that the SDK has not yet received the agent version from the agent, while trying to call the call_agent()
method, resulting in a InvalidAgentVersion
error.
iottly-sdk-python/iottly_sdk/iottly.py
Lines 445 to 453 in 890a18b
The sdk.send() doesn't work when the payload is greater than 65535 bytes (TCP packet max size).
Nothing is sent to the Agent and no exception is raised. sdk.send() stops working.
Probably we need to use socket.send() instead of socket.sendall() and manage the size of payload.
When the SDK is run in a process with not enough permission to connect to the socket no error is notified to the user ๐
A message is sent automatically to the agent when an exception is raised from the callback.
Perhaps this must be written inside SDK documentation.
iottly-sdk-python/iottly_sdk/iottly.py
Lines 455 to 478 in 835feab
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.