Python implementation of simple soap client

From , 4 Years ago, written in Python, viewed 51 times.
URL https://pastebin.vip/view/9ce3c52f
  1. # $Id: testquote.py 2924 2006-11-19 22:24:22Z fredrik $
  2. # delayed stock quote demo (www.xmethods.com)
  3.  
  4. from elementsoap.ElementSOAP import *
  5.  
  6. class QuoteService(SoapService):
  7.     url = "http://66.28.98.121:9090/soap"   # Put webservice URL here.
  8.     def getQuote(self, symbol):
  9.         action = "urn:xmethods-delayed-quotes#getQuote"
  10.         request = SoapRequest("{urn:xmethods-delayed-quotes}getQuote")  # Create the SOAP request
  11.         SoapElement(request, "symbol", "string", symbol)                # Add parameters
  12.         response = self.call(action, request)                           # Call webservice
  13.         return float(response.findtext("Result"))                       # Parse the answer and return it
  14.  
  15. q = QuoteService()
  16. print "MSFT", q.getQuote("MSFT")
  17. print "LNUX", q.getQuote("LNUX")
  18. #//python/1876

Reply to "Python implementation of simple soap client"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website