xmlrpc_test2.py 1003 B

1234567891011121314151617181920212223242526272829
  1. import xmlrpclib, httplib, sys
  2. # Usage: python xmlrpc_test2.py command [params...]
  3. #
  4. # python script for sending an xmlrpc command to ser's xmlrpc module.
  5. # This script uses python xmlrpclib directly and expects the remote side to
  6. # immediately close the connection after answering (broken xmlrpclib
  7. # behaviour).
  8. # There are 2 way to make it work with ser xmlrpc module: define a
  9. # better transport class (that's what the xmlrpc_test.py script is doing) or
  10. # change ser xmlrpc route so that it will close the connection after each
  11. # processes xmlrpc request (e.g. add a drop -1 at the end).
  12. #
  13. # See also: xmlrpc_test.py (better version, using a redefined transport class).
  14. #
  15. # History:
  16. # --------
  17. # 2009-07-13 initial version (andrei)
  18. #
  19. XMLRPC_SERVER = "127.0.0.1"
  20. XMLRPC_PORT = 5060
  21. if len(sys.argv) < 2:
  22. sys.exit("Usage: "+sys.argv[0]+" rpc_command [args...]");
  23. c=xmlrpclib.ServerProxy("http://" + XMLRPC_SERVER+ ":" + str(XMLRPC_PORT))
  24. res=getattr(c, sys.argv[1])(*sys.argv[2:])
  25. print res;