Registry / http-networking / suds
library1.2.0pypypi✓ verified 85d ago

Suds is a lightweight SOAP-based web service client for Python. This is a community fork of the `suds-jurko` fork, actively maintained to support modern Python versions (>=3.7). It provides an intuitive RPC-like interface to consume web services by objectifying WSDL-defined types without explicit class generation. The latest version is 1.2.0, released in August 2024, with a release cadence that has seen several updates in recent years.

pip install suds
INSTALL
IMPORT
SIG · SUDS
S
suds
http-networkingpythonv1.2.0
Install
1.6s avg
Import
174ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.185s · 18.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.163s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from suds.client import Client
import suds.client; client = suds.client.Client(...)
While `import suds.client` works, `from suds.client import Client` is the idiomatic and recommended way to access the primary client class.

This quickstart demonstrates how to create a `suds` client, inspect available service methods, and invoke a simple SOAP operation using a publicly available temperature conversion WSDL. It also includes basic logging configuration essential for debugging SOAP interactions.

import logging import os from suds.client import Client # Configure logging to see SOAP requests/responses for debugging logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG) # A public WSDL for temperature conversion wsdl_url = 'http://www.w3schools.com/xml/tempconvert.asmx?WSDL' try: # Create a Suds client client = Client(wsdl_url) print(f"Connected to SOAP service at: {wsdl_url}") print("\nAvailable service methods:") print(client) # Invoke a method: FahrenheitToCelsius fahrenheit_temp = 68.0 result = client.service.FahrenheitToCelsius(fahrenheit_temp) print(f"\n{fahrenheit_temp}°F is {result}°C") # Invoke another method: CelsiusToFahrenheit celsius_temp = 20.0 result = client.service.CelsiusToFahrenheit(celsius_temp) print(f"{celsius_temp}°C is {result}°F") except Exception as e: print(f"An error occurred: {e}") print("Ensure the WSDL URL is correct and reachable, and that the service is active.")
Debug
Known issues
breakingThe `suds` project (version 1.x) is a community fork that explicitly supports Python 3.7+ only. Older versions of `suds` (0.4 and prior) were Python 2.x only. Trying to use this `suds` version with Python 2.x or an older Python 3.x interpreter (e.g., <3.7) will result in compatibility errors. Users migrating from the original `suds` or `suds-jurko` must ensure their Python environment is 3.7 or newer.
fix
Ensure your project uses Python 3.7 or a newer version. Install using `pip install suds` to get the latest Python 3 compatible community fork.
affects: <1.0.0 (Python 2.x only); <1.2.0 (Python <3.7 support dropped)
gotchaWhen dealing with complex WSDL types that are subclasses or extensions of other types, directly passing a Python dictionary to represent these objects may cause issues. `suds` might not correctly infer the `xsi:type`, leading the server to reject the request (e.g., trying to instantiate an abstract base type instead of the concrete subclass).
fix
Always use `client.factory.create('TypeName')` to instantiate complex types defined in the WSDL. This ensures `suds` correctly sets the `xsi:type` attribute in the SOAP request.
affects: All versions
gotchaBy default, `suds` logging is not verbose. It's common to miss crucial debug information (like the actual SOAP request/response XML or HTTP headers) when troubleshooting issues with web service calls.
fix
To enable detailed logging, configure Python's standard `logging` module. Set levels to `DEBUG` for `suds.client`, `suds.transport`, `suds.xsd.schema`, and `suds.wsdl` to see SOAP messages and other internal processes.
affects: All versions
breakingVersion 0.8.0 introduced a change where objects are no longer instantiated with empty optional attributes by default. This changes the behavior from previous versions where such attributes might have been present as empty lists or `None` without explicit definition.
fix
Review code that relies on optional attributes being implicitly present in instantiated objects. You may need to explicitly check for attribute existence or modify your handling of service object structures.
affects: >=0.8.0 (compared to <0.8.0)
gotchaMany WSDLs or their imported schemas can be malformed or follow incorrect import rules, causing `suds` to fail during WSDL parsing or schema digestion. This is a common external factor leading to `suds` errors.
fix
Use the `suds.xsd.doctor.ImportDoctor` to fix broken schema imports at runtime if you encounter `schema not found` or similar errors during client initialization. This allows you to patch WSDLs with missing or incorrect schema references. For example: `from suds.xsd.doctor import Import, ImportDoctor; imp = Import('http://schemas.xmlsoap.org/soap/encoding/'); doctor = ImportDoctor(imp); client = Client(wsdl_url, doctor=doctor)`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'suds.client'
The `suds` package is not installed in the current Python environment, or an incompatible package like `suds-jurko` is installed while the code expects the modern `suds` fork.
fix
Ensure the correct `suds` package is installed using `pip install suds`. If `suds-jurko` is present, consider uninstalling it first with `pip uninstall suds-jurko`.
KeyError: 'No object with type name: MyTypeName'
The type name specified in `client.factory.create('MyTypeName')` does not exactly match a type defined in the WSDL, or the WSDL failed to load or parse completely.
fix
Verify the WSDL URL is correct and accessible. Use `print(client.sd())` to inspect the WSDL's schema definition and find the exact, case-sensitive name of the type you wish to create.
AttributeError: '<ServicePort>' object has no attribute 'MyMethodName'
The method `MyMethodName` is not defined or is misspelled in the WSDL for the target service port, or the WSDL was not parsed correctly, preventing the service object from exposing its methods.
fix
Confirm the WSDL URL is correct and the service is available. Use `print(client)` or `print(client.service)` to inspect the available service ports and their methods, paying close attention to case sensitivity and parameters.
ssl.SSLCertificateError: CERTIFICATE_VERIFY_FAILED
Python's SSL module cannot verify the server's certificate due to issues like a self-signed certificate, an expired certificate, or a missing/untrusted root certificate authority in the system's trust store.
fix
For development/testing, disable SSL verification: `from suds.transport.https import HttpAuthenticated` and then `client = Client(wsdl_url, transport=HttpAuthenticated(verify=False))`. For production, ensure the server has a valid, trusted certificate or properly configure your system's certificate trust store.
Upgrade
Version history
1.2.0latest on PyPI · released Aug 24, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources