diff WebServiceToolWorkflow/workflowclients/client_1.py~ @ 0:d5cd409b8a18 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author ganjoo
date Tue, 07 Jun 2011 18:00:50 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebServiceToolWorkflow/workflowclients/client_1.py~	Tue Jun 07 18:00:50 2011 -0400
@@ -0,0 +1,38 @@
+import os
+import sys
+import urllib
+'''This script is the client for invoking RESTful Web services.'''
+
+outputFile = open(sys.argv[1],'w')
+resUrl = sys.argv[2]
+
+if(resUrl.find('__tilda__')>-1):
+    ulist = resUrl.split('__tilda__')
+    resUrl = '~'.join(ulist)
+    
+paramdict={}
+length=(len(sys.argv))
+
+i=3
+while( i>=3 and i<(length-1)):
+    key=sys.argv[i]
+    val=sys.argv[i+1]
+    if val=='fileInput':
+        print '##########fileInput found#############'
+        f=open(sys.argv[i+2])
+        line = f.readline().strip('\n')
+        line = line.strip(' ')
+        val=line        
+        i=i+1
+    
+    while(val.find('**')>-1):
+        vlist = val.split('**')
+	val = ' '.join(vlist)
+    print key + '\t' + val
+    paramdict[key]=val
+    i=i+2
+
+params = urllib.urlencode(paramdict)
+data = urllib.urlopen(resUrl, params).read()
+outputFile.write(data)
+outputFile.close()