Mercurial > repos > ganjoo > webservice_toolsuite
annotate WebServiceToolWorkflow/workflowclients/client_1.py @ 0:e7482c82796e 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 17:34:26 -0400 |
| parents | |
| children |
| rev | line source |
|---|---|
|
0
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
1 import os |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
2 import sys |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
3 import urllib |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
4 '''This script is the client for invoking RESTful Web services.''' |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
5 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
6 outputFile = open(sys.argv[1],'w') |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
7 resUrl = sys.argv[2] |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
8 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
9 if(resUrl.find('__tilda__')>-1): |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
10 ulist = resUrl.split('__tilda__') |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
11 resUrl = '~'.join(ulist) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
12 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
13 paramdict={} |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
14 length=(len(sys.argv)) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
15 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
16 i=3 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
17 while( i>=3 and i<(length-1)): |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
18 key=sys.argv[i] |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
19 val=sys.argv[i+1] |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
20 if val=='fileInput': |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
21 print '##########fileInput found#############' |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
22 f=open(sys.argv[i+2]) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
23 line = f.readline().strip('\n') |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
24 line = line.strip(' ') |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
25 val = line |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
26 i=i+1 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
27 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
28 while(val.find('**')>-1): |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
29 vlist = val.split('**') |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
30 val = ' '.join(vlist) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
31 print key + '\t' + val |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
32 paramdict[key]=val |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
33 i=i+2 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
34 |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
35 params = urllib.urlencode(paramdict) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
36 data = urllib.urlopen(resUrl, params).read() |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
37 outputFile.write(data) |
|
e7482c82796e
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
38 outputFile.close() |
