root/hodgestar/PythonCode/SmallScripts/xrcli.py

Revision 375, 502 bytes (checked in by simon, 4 years ago)

Miscellaneous small scripts.

  • Property svn:mime-type set to text/python-source
  • Property svn:eol-style set to native
Line 
1import sys, xmlrpclib
2
3def usage(aArgs):
4    print aArgs[0], "<server url>", "<method name>", "[<param> <param> ...]"
5
6def main(aArgs):
7    if len(aArgs) < 3:
8        usage(aArgs)
9        return 1
10
11    sUrl = aArgs[1]
12    aMethodPath = aArgs[2].split('.')
13    aParams = aArgs[3:]
14
15    oS = xmlrpclib.Server(sUrl)
16    fMeth = oS
17    for sMeth in aMethodPath:
18        fMeth = getattr(fMeth,sMeth)
19   
20    print fMeth(*aParams)
21   
22    return 0
23
24if __name__ == "__main__":
25    sys.exit(main(sys.argv))
26
Note: See TracBrowser for help on using the browser.