@@ -0,0 +1,1521 @@
+#==============================================================================%0A# rpc_flush_datastack.py%0A# Python script that flushes a dataport for a device%0A#%0A# IMPORTANT NOTE!!: This will remove all data in a dataport (data source)%0A# USE AT YOUR OWN RISK%0A#%0A#%0A#==============================================================================%0A## Tested with python 2.6.5%0A##%0A## Copyright (c) 2010, Exosite LLC%0A## All rights reserved.%0A##%0A## For License see LICENSE file%0A%0Aimport socket%0Aimport sys%0Atry:%0A  if sys.version_info %3C (2 , 6):%0A    json_module= 'python-simplejson'%0A    import simplejson as json%0A  else:%0A    json_module= 'python-json'%0A    import json%0Aexcept ImportError:%0A  print %22The package '%25s' is required.%22 %25 json_module%0A  sys.exit(1)%0A%0A%0AHOST = 'm2.exosite.com'%0APORT = 80%0ADEVICECIK = 'YOUR CIK HERE'%0AALIAS = 'YOUR ALIAS HERE'%0ARESOURCEID = %7B%22alias%22:ALIAS%7D%0A#RESOURCEID = 'DATA STACK RID' # Use instead of ALIAS%0A%0AARGUMENTS = %5BRESOURCEID%5D%0APROCEDURE = %22flush%22%0ACALLREQUEST1 = %7B%22id%22 : 1, %22procedure%22:PROCEDURE, %22arguments%22:ARGUMENTS%7D%0ACALLS = %5BCALLREQUEST1%5D%0AAUTH = %7B %22cik%22 : DEVICECIK %7D%0ARPC = %7B %22auth%22 : AUTH, %22calls%22:CALLS%7D%0A%0Ajson_rpc = json.dumps(RPC)%0A%0As = socket.socket(socket.AF_INET, socket.SOCK_STREAM)%0As.connect((HOST, PORT))%0As.send('POST /api:v1/rpc/process HTTP/1.1%5Cr%5Cn')%0As.send('Host: m2.exosite.com%5Cr%5Cn')%0As.send('Content-Type: application/json; charset=utf-8%5Cr%5Cn')%0Abody = json_rpc%0As.send('Content-Length: '+ str(len(body)) +'%5Cr%5Cn%5Cr%5Cn')%0As.send(body)%0A%0Adata = s.recv(1024)%0As.close()%0Aprint 'Received: %5Cr%5Cn', str(data)%0A%0A

Add flush data stack example utility file