Mercurial > repos > ganjoo > webservice_toolsuite
annotate WebServiceToolWorkflow/clients/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 |
rev | line source |
---|---|
0
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
1 import os |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
2 import sys |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
3 import urllib |
d5cd409b8a18
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.''' |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
5 |
d5cd409b8a18
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') |
d5cd409b8a18
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] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
8 |
d5cd409b8a18
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): |
d5cd409b8a18
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__') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
11 resUrl = '~'.join(ulist) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
12 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
13 paramdict={} |
d5cd409b8a18
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)) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
15 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
16 i=3 |
d5cd409b8a18
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)): |
d5cd409b8a18
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] |
d5cd409b8a18
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] |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
20 while(val.find('**')>-1): |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
21 vlist = val.split('**') |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
22 val = ' '.join(vlist) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
23 paramdict[key]=val |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
24 i=i+2 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
25 |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
26 params = urllib.urlencode(paramdict) |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
27 data = urllib.urlopen(resUrl, params).read() |
d5cd409b8a18
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff
changeset
|
28 outputFile.write(data) |