A fork of https://github.com/Synerty/SOAPpy-py3 This is a working tree till fixes get imported upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
1.2 KiB

  1. #!/usr/bin/env python
  2. # Copyright (c) 2001 actzero, inc. All rights reserved.
  3. ident = '$Id: quoteTest.py,v 1.5 2003/12/18 06:31:50 warnes Exp $'
  4. import os, re
  5. import sys
  6. sys.path.insert(1, "..")
  7. from SOAPpy import SOAPProxy
  8. # Check for a web proxy definition in environment
  9. try:
  10. proxy_url=os.environ['http_proxy']
  11. phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2)
  12. proxy = "%s:%s" % (phost, pport)
  13. except:
  14. proxy = None
  15. # Three ways to do namespaces, force it at the server level
  16. server = SOAPProxy("http://services.xmethods.com:9090/soap",
  17. namespace = 'urn:xmethods-delayed-quotes',
  18. http_proxy=proxy)
  19. print "IBM>>", server.getQuote(symbol = 'IBM')
  20. # Do it inline ala SOAP::LITE, also specify the actually ns
  21. server = SOAPProxy("http://services.xmethods.com:9090/soap",
  22. http_proxy=proxy)
  23. print "IBM>>", server._ns('ns1',
  24. 'urn:xmethods-delayed-quotes').getQuote(symbol = 'IBM')
  25. # Create a namespaced version of your server
  26. dq = server._ns('urn:xmethods-delayed-quotes')
  27. print "IBM>>", dq.getQuote(symbol='IBM')
  28. print "ORCL>>", dq.getQuote(symbol='ORCL')
  29. print "INTC>>", dq.getQuote(symbol='INTC')