Skip to content

Commit 251b979

Browse files
committed
Updating python example to query FM.
1 parent bde5bcb commit 251b979

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

examples/labcas-xmlrpc-example-filemgr-client.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,27 @@ def printProductType(productTypeDict):
99
print '\t%s = %s' % (key, value)
1010

1111
if __name__ == '__main__':
12-
13-
# connect to File Manager server
14-
# use verbose=True to print out every request/response
15-
verbose=False
16-
server = xmlrpclib.ServerProxy('http://localhost:9000/', verbose=verbose)
17-
18-
print "Server is alive: %s" % server.filemgr.isAlive()
19-
20-
productTypes = server.filemgr.getProductTypes()
21-
for productTypeDict in productTypes:
22-
printProductType(productTypeDict)
12+
13+
# connect to File Manager server
14+
# use verbose=True to print out every request/response
15+
verbose=False
16+
server = xmlrpclib.ServerProxy('http://localhost:9000/', verbose=verbose)
17+
18+
# test server is alive
19+
print "Server is alive: %s" % server.filemgr.isAlive()
20+
21+
# query all product types
22+
productTypes = server.filemgr.getProductTypes()
23+
for productTypeDict in productTypes:
24+
printProductType(productTypeDict)
25+
26+
# retrieve a specific product type
27+
# returned result is a dictionary suitable as argument for next call
28+
productTypeName = "miRNAStudyPine"
29+
productType = server.filemgr.getProductTypeByName(productTypeName)
30+
31+
# query all products of a given type
32+
products = server.filemgr.getProductsByProductType( productType )
33+
print 'Printing products'
34+
for product in products:
35+
print product

0 commit comments

Comments
 (0)