Convert Figma logo to code with AI

mvantellingen logopython-zeep

A Python SOAP client

1,879
583
1,879
458

Quick Overview

Zeep is a Python SOAP client library that provides a modern and user-friendly interface for working with SOAP web services. It offers automatic XML parsing, type conversion, and supports complex WSDL structures, making it easier to interact with SOAP APIs in Python applications.

Pros

  • Easy to use with a simple and intuitive API
  • Supports complex WSDL structures and XML schemas
  • Automatic type conversion between Python and XML
  • Extensible with custom data types and transport methods

Cons

  • Performance can be slower compared to lower-level XML libraries
  • Limited support for older SOAP versions and non-standard implementations
  • Documentation could be more comprehensive for advanced use cases
  • Debugging complex SOAP issues can be challenging

Code Examples

  1. Creating a SOAP client and making a simple request:
from zeep import Client

client = Client('http://www.webservicex.net/ConvertSpeed.asmx?WSDL')
result = client.service.ConvertSpeed(
    speed=100,
    fromUnit='kilometersPerHour',
    toUnit='milesPerHour'
)
print(f"100 km/h is equal to {result} mph")
  1. Using a custom transport with authentication:
from zeep import Client
from zeep.transports import Transport
from requests import Session

session = Session()
session.auth = ('username', 'password')
transport = Transport(session=session)

client = Client('http://example.com/service?WSDL', transport=transport)
result = client.service.SomeOperation(param1='value1', param2='value2')
  1. Working with complex types:
from zeep import Client

client = Client('http://example.com/complex_service?WSDL')

# Create a complex type instance
address_type = client.get_type('ns0:AddressType')
address = address_type(
    street='123 Main St',
    city='Anytown',
    state='CA',
    zip='12345'
)

# Use the complex type in a service call
result = client.service.CreateCustomer(name='John Doe', address=address)

Getting Started

To get started with Zeep, follow these steps:

  1. Install Zeep using pip:

    pip install zeep
    
  2. Import the Client class and create a client instance:

    from zeep import Client
    client = Client('http://example.com/service?WSDL')
    
  3. Call a service method:

    result = client.service.SomeMethod(param1='value1', param2='value2')
    print(result)
    

For more advanced usage and configuration options, refer to the official Zeep documentation.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

======================== Zeep: Python SOAP client

A Python SOAP client

Highlights:

  • Compatible with Python 3.7, 3.8, 3.9, 3.10, 3.11 and PyPy3
  • Build on top of lxml, requests and httpx
  • Support for Soap 1.1, Soap 1.2 and HTTP bindings
  • Support for WS-Addressing headers
  • Support for WSSE (UserNameToken / x.509 signing)
  • Support for asyncio using the httpx module
  • Experimental support for XOP messages

Please see for more information the documentation at http://docs.python-zeep.org/

.. start-no-pypi

Status

I consider this library to be stable. Since no new developments happen around the SOAP specification it won't be updated that much. Good PR's which fix bugs are always welcome however.

.. image:: https://readthedocs.org/projects/python-zeep/badge/?version=latest :target: https://readthedocs.org/projects/python-zeep/

.. image:: https://github.com/mvantellingen/python-zeep/workflows/Python%20Tests/badge.svg :target: https://github.com/mvantellingen/python-zeep/actions?query=workflow%3A%22Python+Tests%22

.. image:: http://codecov.io/github/mvantellingen/python-zeep/coverage.svg?branch=master :target: http://codecov.io/github/mvantellingen/python-zeep?branch=master

.. image:: https://img.shields.io/pypi/v/zeep.svg :target: https://pypi.python.org/pypi/zeep/

.. end-no-pypi

Installation

.. code-block:: bash

pip install zeep

Note that the latest version to support Python 2.7, 3.3, 3.4 and 3.5 is Zeep 3.4, install via pip install zeep==3.4.0

Zeep uses the lxml library for parsing xml. See https://lxml.de/installation.html for the installation requirements.

Usage

.. code-block:: python

from zeep import Client

client = Client('tests/wsdl_files/example.rst')
client.service.ping()

To quickly inspect a WSDL file use::

python -m zeep <url-to-wsdl>

Please see the documentation at http://docs.python-zeep.org for more information.

Support

If you want to report a bug then please first read http://docs.python-zeep.org/en/master/reporting_bugs.html

Please only report bugs and not support requests to the GitHub issue tracker.