Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2016 07:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amirasaran/9ee4763daa644a63c29638a041a007a1 to your computer and use it in GitHub Desktop.
simple soap client for python
from zeep import helpers, Client
import types
class SoapConnector(object):
def __init__(self, base_url):
self._client = Client(base_url)
def send(self, method, data):
connector = getattr(self._client.service, method)
result = connector(**data)
return helpers.serialize_object(result) \
if isinstance(result, types.ListType) or isinstance(result, types.ClassType) else result
client = SoapConnector("")
data = {
"speed": "100",
"FromUnit": "kilometersPerhour",
"ToUnit": "milesPerhour"
result = client.send('ConvertSpeed', data)
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment