1.) Try this example in the web services console: Examples -> SCI -> Python
Here is an example of the python code you’d run on the device to receive and respond to the request: http://www.digi.com/wiki/developer/index.php/Module:rci#Example_.231. Note that the call to rci.add_rci_callback is blocking, so if you need to perform other actions in your script you’ll need to spawn a thread.
2.) Use the Examples found at SCI -> Data Service -> Send Request/Send Binary Request
This one requires pretty recent firmware on your device. It has the benefit of transferring binary data without having to base64 decode it on the device, and the register call on the device doesn’t block.
The python code would look like this:
import idigidata
def my_callback(target, data):
print data
return "received %s from target %s" % (data, target)
idigidata.register_callback("myTarget", my_callback)