Settings

New in version 3.0.

Context manager

You can set various options directly as attribute on the client or via a context manager.

For example to let zeep return the raw response directly instead of processing it you can do the following:

from zeep import Client
from zeep import xsd

client = Client('http://my-endpoint.com/production.svc?wsdl')

with client.settings(raw_response=True):
    response = client.service.myoperation()

    # response is now a regular requests.Response object
    assert response.status_code == 200
    assert response.content

API

class zeep.settings.Settings(strict=True, raw_response=False, force_https=True, extra_http_headers=None, xml_huge_tree=False, forbid_dtd=False, forbid_entities=True, forbid_external=True, xsd_ignore_sequence_order=False, tls=NOTHING)
Parameters:
  • strict (boolean) – boolean to indicate if the lxml should be parsed a ‘strict’. If false then the recover mode is enabled which tries to parse invalid XML as best as it can.
  • raw_response – boolean to skip the parsing of the XML response by zeep but instead returning the raw data
  • forbid_dtd (bool) – disallow XML with a <!DOCTYPE> processing instruction
  • forbid_entities (bool) – disallow XML with <!ENTITY> declarations inside the DTD
  • forbid_external (bool) – disallow any access to remote or local resources in external entities or DTD and raising an ExternalReferenceForbidden exception when a DTD or entity references an external resource.
  • xml_huge_tree – disable lxml/libxml2 security restrictions and support very deep trees and very long text content
  • force_https (bool) – Force all connections to HTTPS if the WSDL is also loaded from an HTTPS endpoint. (default: true)
  • extra_http_headers – Additional HTTP headers to be sent to the transport. This can be used in combination with the context manager approach to add http headers for specific calls.
  • xsd_ignore_sequence_order (boolean) – boolean to indicate whether to enforce sequence order when parsing complex types. This is a workaround for servers that don’t respect sequence order.