Zeep - Python SOAP Client

4.3.2 · active · verified Sat Mar 28

Zeep is a fast and modern Python SOAP client library, currently at version 4.3.2. It simplifies interactions with SOAP web services by inspecting WSDL documents and generating a Pythonic interface. The library is considered stable, focusing on bug fixes, with major releases occurring less frequently, typically when significant changes to Python support or underlying dependencies are required.

Warnings

Install

Imports

Quickstart

Initializes a Zeep client with a WSDL URL and makes a synchronous call to a public SOAP service. This example demonstrates basic client instantiation and calling a service operation. Replace the WSDL_URL with your target service's WSDL. For asynchronous operations, use `AsyncClient` and `AsyncTransport`.

import os
from zeep import Client

# A public WSDL for demonstration purposes
wsdl_url = os.environ.get('ZEEP_WSDL_URL', 'http://www.webservicex.net/ConvertSpeed.asmx?WSDL')

try:
    client = Client(wsdl_url)
    # Inspect available services and operations
    print(f"Service operations: {list(client.service._operations.keys())}")

    # Call a service operation
    result = client.service.ConvertSpeed(100, 'kilometersPerhour', 'milesPerhour')
    print(f"100 km/h in mph: {result}")

except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure the WSDL URL is accessible and valid.")
    print("You can try setting the ZEEP_WSDL_URL environment variable.")

view raw JSON →