A modern/fast python SOAP client based on lxml / requests

Overview

Zeep: Python SOAP client

A fast and modern Python SOAP client

Highlights:
  • Compatible with Python 3.6, 3.7, 3.8 and PyPy
  • Build on top of lxml and requests
  • 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/

Status

https://readthedocs.org/projects/python-zeep/badge/?version=latest http://codecov.io/github/mvantellingen/python-zeep/coverage.svg?branch=master

Installation

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

Usage

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.

Issues
  • Impossible to initialize async instance if loop currently running

    Impossible to initialize async instance if loop currently running

    1. The version of zeep (or if you are running master the commit hash/date) zeep==1.1.0
    2. The WSDL you are using https://webservices2.autotask.net/ATServices/1.5/atws.asmx?WSDL
    3. An example script

    Without sensetive data

    import asyncio
    
    loop = asyncio.get_event_loop()
    
    async def func():
        def start_client():
            session = aiohttp.ClientSession(
                auth=aiohttp.BasicAuth(
                    login='login',
                    password='password'
                ),
                loop=loop
            )    # loop is running -> no warnings
    
            transport = zeep.asyncio.AsyncTransport(
                loop=loop,
                cache=zeep.cache.InMemoryCache(),
                session=session
            )
    
        client = zeep.Client(
            wsdl=wsdl,
            transport=transport
        )
    

    Caused:

    lib/python3.5/site-packages/zeep/asyncio/transport.py", line 45, in _load_remote_data
        self.loop.run_until_complete(_load_remote_data_async())
      File "uvloop/loop.pyx", line 1198, in uvloop.loop.Loop.run_until_complete (uvloop/loop.c:25480)
      File "uvloop/loop.pyx", line 1191, in uvloop.loop.Loop.run_until_complete (uvloop/loop.c:25324)
      File "uvloop/loop.pyx", line 1100, in uvloop.loop.Loop.run_forever (uvloop/loop.c:24056)
      File "uvloop/loop.pyx", line 355, in uvloop.loop.Loop._run (uvloop/loop.c:11384)
    RuntimeError: this event loop is already running.
    

    Solution:

    if self.loop.is_running():
        # here we should call synchronous API (requests)
        # it may look like ugly, but currently it's only one solution
    else:
        self.loop.run_until_complete(
            _load_remote_data_async()
        )
    
    enhancement help wanted component/async 
    opened by penguinolog 18
  • getting python objects (list, dict) instead of zeep.objects in the result?

    getting python objects (list, dict) instead of zeep.objects in the result?

    Hello

    Is it possible to get the results as python types like dict and list instead of zeep.objects ? Or is there an easy way to transform them?

    Thanks

    opened by YAmikep 18
  • Arrays in the Request

    Arrays in the Request

    I'm having problems formatting a request that contains an array of input messages... when the renderer hits an array it doesn't add each element of the array to the soap message - and it throws an exception because the sub_value is None... getattr() returns None because it's looking for the element name - but the value is an array. I'm working with the types and elements source trying to debug it - not sure if it's a problem with the code or with the way I'm building the request message.

    Exception:

    <type 'exceptions.TypeError'>, TypeError("'NoneType' object is not iterable",), None
    

    At: elements.py:

       def render(self, parent, value):
              for val in value:
                node = etree.SubElement(parent, self.qname)
                self.type.render(node, val)
    

    Code I'm using to populate the soap request:

            api_client = Client(api_address_setting.setting_value + 'GetEntityWebService.asmx?WSDL')
            search_parameter_type = api_client.get_type('ns1:EntitySearchParameter')
            search_parameter = search_parameter_type()
            search_parameter.FieldName = 'Id'
            search_parameter.FieldValue = '0'
            search_parameter.Operator = 'GreaterThan'
            entity_search_clause_type = api_client.get_type('ns1:EntitySearchClause')
            entity_search_clause = entity_search_clause_type()
            entity_search_clause.Operator = 'And'
            entity_search_clause.SearchParameters = []
            entity_search_clause.SearchParameters.append(search_parameter)
            entity_request_type = api_client.get_type('ns1:EntityRequest')
            entity_request = entity_request_type()
            entity_request.EntityType = 'Staff'
            entity_request.EntitySearchClauses = [];
            entity_request.EntitySearchClauses.append(entity_search_clause)
            entity_request.RequestId = 0
            entity_msg_type = api_client.get_type('ns1:GetEntityInMsg')
            entity_msg = entity_msg_type()
            entity_msg.CorrelationId = -1
            entity_msg.CustomAttributes = []
            entity_msg.Entity = entity_request
            entity_msg.MessageId = -1
            entity_msg.RowCount = 0
            entity_msg.SkipSemanticValidation = False
            staff_req_type = api_client.get_type('ns1:GetEntityRequest')
            staff_req = staff_req_type()
            staff_req.TokenId = tokenId
            staff_req.Entities = []
            staff_req.Entities.append(entity_msg)
            staff_result = api_client.service.GetEntity(staff_req)
    

    Sample soap message that works (from a .net client):

    <GetEntityRequest xmlns="http://www.companyname.com/Soa/Foundation/MessageDefinition.xsd">
      <TokenId>2KVFvpE... etc...</TokenId>
      <Entities>
        <GetEntityInMsg>
          <Entity>
            <RequestId>0</RequestId>
            <EntityType>Staff</EntityType>
            <EntitySearchClauses>
              <SearchParameters>
                <FieldName>Id</FieldName>
                <FieldValue>0</FieldValue>
                <Operator>GreaterThan</Operator>
              </SearchParameters>
              <Operator>And</Operator>
            </EntitySearchClauses>
          </Entity>
        </GetEntityInMsg>
        <GetEntityInMsg>
          <Entity>
            <RequestId>1</RequestId>
            <EntityType>Campus</EntityType>
            <EntitySearchClauses>
              <SearchParameters>
                <FieldName>Id</FieldName>
                <FieldValue>0</FieldValue>
                <Operator>GreaterThan</Operator>
              </SearchParameters>
              <Operator>And</Operator>
            </EntitySearchClauses>
          </Entity>
        </GetEntityInMsg>
      </Entities>
    </GetEntityRequest>
    

    Here's the wsdl:

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.company.com/Soa/Foundation/" xmlns:s1="http://www.company.com/Soa/Foundation/MessageDefinition.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.company.com/Soa/Foundation/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
        <s:schema elementFormDefault="qualified" targetNamespace="http://www.company.com/Soa/Foundation/">
          <s:import namespace="http://www.company.com/Soa/Foundation/MessageDefinition.xsd" />
          <s:element name="GetSearchableAttributes">
            <s:complexType>
              <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" ref="s1:GetSearchableAttributeRequest" />
              </s:sequence>
            </s:complexType>
          </s:element>
          <s:element name="GetSearchableAttributesResponse">
            <s:complexType>
              <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" ref="s1:GetSearchableAttributeResponse" />
              </s:sequence>
            </s:complexType>
          </s:element>
          <s:element name="RequestHeader" type="tns:RequestHeader" />
          <s:complexType name="RequestHeader">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="Headers" type="tns:ArrayOfAnyType" />
            </s:sequence>
            <s:anyAttribute />
          </s:complexType>
          <s:complexType name="ArrayOfAnyType">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="anyType" nillable="true" />
            </s:sequence>
          </s:complexType>
          <s:element name="ResponseHeader" type="tns:ResponseHeader" />
          <s:complexType name="ResponseHeader">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="Headers" type="tns:ArrayOfAnyType" />
            </s:sequence>
            <s:anyAttribute />
          </s:complexType>
          <s:element name="GetEntity">
            <s:complexType>
              <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" ref="s1:GetEntityRequest" />
              </s:sequence>
            </s:complexType>
          </s:element>
          <s:element name="GetEntityResponse">
            <s:complexType>
              <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" ref="s1:GetEntityResponse" />
              </s:sequence>
            </s:complexType>
          </s:element>
        </s:schema>
        <s:schema elementFormDefault="qualified" targetNamespace="http://www.company.com/Soa/Foundation/MessageDefinition.xsd">
          <s:element name="GetSearchableAttributeRequest" type="s1:GetSearchableAttributeRequest" />
          <s:complexType name="GetSearchableAttributeRequest">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericRequest">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="GetSearchableAttributes" type="s1:ArrayOfGetSearchableAttributeInMsg" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="GenericRequest">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="TokenId" type="s:string" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ArrayOfGetSearchableAttributeInMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="GetSearchableAttributeInMsg" nillable="true" type="s1:GetSearchableAttributeInMsg" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="GetSearchableAttributeInMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericInMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="BusinessEntityType" type="s:string" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="GenericInMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="MessageState" type="s:string" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="GenericMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" default="-1" name="MessageId" type="s:int" />
              <s:element minOccurs="0" maxOccurs="1" name="CustomAttributes" type="s1:ArrayOfCustomAttributeMsg" />
              <s:element minOccurs="0" maxOccurs="1" default="-1" name="CorrelationId" type="s:int" />
              <s:element minOccurs="0" maxOccurs="1" default="false" name="SkipSemanticValidation" type="s:boolean" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ArrayOfCustomAttributeMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="CustomAttributeMsg" nillable="true" type="s1:CustomAttributeMsg" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="CustomAttributeMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="GenericOutMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="MessageResult" type="s:string" />
                  <s:element minOccurs="0" maxOccurs="1" default="OK" name="MessageStatus" type="s1:MessageStatusType" />
                  <s:element minOccurs="0" maxOccurs="1" name="MessageErrorCode" type="s:string" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:simpleType name="MessageStatusType">
            <s:restriction base="s:string">
              <s:enumeration value="OK" />
              <s:enumeration value="FailedValidation" />
              <s:enumeration value="FailedExecution" />
              <s:enumeration value="FailedAuthorization" />
              <s:enumeration value="FailedOther" />
            </s:restriction>
          </s:simpleType>
          <s:complexType name="GetSearchableAttributeOutMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericOutMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="BusinessEntityType" type="s:string" />
                  <s:element minOccurs="0" maxOccurs="unbounded" name="SearchableAttributes" type="s1:CustomAttributeMsg" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:element name="GetSearchableAttributeResponse" type="s1:GetSearchableAttributeResponse" />
          <s:complexType name="GetSearchableAttributeResponse">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericResponse">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="GetSearchableAttributes" type="s1:ArrayOfGetSearchableAttributeOutMsg" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="GenericResponse">
            <s:sequence>
              <s:element minOccurs="1" maxOccurs="1" name="Status" type="s1:TrxStatus" />
              <s:element minOccurs="0" maxOccurs="1" name="TrxResult" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="TokenId" type="s:string" />
            </s:sequence>
          </s:complexType>
          <s:simpleType name="TrxStatus">
            <s:restriction base="s:string">
              <s:enumeration value="OK" />
              <s:enumeration value="ErrorSQL" />
              <s:enumeration value="ErrorBusinessLogic" />
              <s:enumeration value="ErrorWebService" />
              <s:enumeration value="ErrorArguments" />
              <s:enumeration value="ErrorSecurity" />
              <s:enumeration value="ErrorSystem" />
              <s:enumeration value="ErrorMultiple" />
            </s:restriction>
          </s:simpleType>
          <s:complexType name="ArrayOfGetSearchableAttributeOutMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="GetSearchableAttributeOutMsg" nillable="true" type="s1:GetSearchableAttributeOutMsg" />
            </s:sequence>
          </s:complexType>
          <s:element name="GetEntityRequest" type="s1:GetEntityRequest" />
          <s:complexType name="GetEntityRequest">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericRequest">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="Entities" type="s1:ArrayOfGetEntityInMsg" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="ArrayOfGetEntityInMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="GetEntityInMsg" nillable="true" type="s1:GetEntityInMsg" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="GetEntityInMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericInMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" default="0" name="RowCount" type="s:int" />
                  <s:element minOccurs="0" maxOccurs="1" name="Entity" type="s1:EntityRequest" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="EntityRequest">
            <s:complexContent mixed="false">
              <s:extension base="s1:EntityMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="unbounded" name="EntitySearchClauses" type="s1:EntitySearchClause" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="EntityMsg">
            <s:sequence>
              <s:element minOccurs="1" maxOccurs="1" name="RequestId" type="s:int" />
              <s:element minOccurs="0" maxOccurs="1" name="EntityType" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="EntityAssembly" type="s:string" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="SerializedEntity">
            <s:complexContent mixed="false">
              <s:extension base="s1:EntityMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="EntityString" type="s:string" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:complexType name="EntitySearchClause">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="SearchParameters" type="s1:EntitySearchParameter" />
              <s:element minOccurs="1" maxOccurs="1" name="Operator" type="s1:ClauseOperatorType" />
              <s:element minOccurs="0" maxOccurs="unbounded" name="QueryFlags" type="s1:QueryFlagType" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="EntitySearchParameter">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="FieldName" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="FieldValue" type="s:string" />
              <s:element minOccurs="1" maxOccurs="1" name="Operator" type="s1:ParameterOperatorType" />
            </s:sequence>
          </s:complexType>
          <s:simpleType name="ParameterOperatorType">
            <s:restriction base="s:string">
              <s:enumeration value="Equal" />
              <s:enumeration value="NotEqual" />
              <s:enumeration value="GreaterThan" />
              <s:enumeration value="GreaterThanOrEqual" />
              <s:enumeration value="LessThan" />
              <s:enumeration value="LessThanOrEqual" />
              <s:enumeration value="Like" />
              <s:enumeration value="IsNull" />
              <s:enumeration value="IsNullOrZero" />
              <s:enumeration value="IsNullOrEmptyString" />
              <s:enumeration value="IsNotNull" />
              <s:enumeration value="Between" />
              <s:enumeration value="In" />
              <s:enumeration value="NotIn" />
              <s:enumeration value="NotLike" />
              <s:enumeration value="BitWiseOR" />
              <s:enumeration value="BitWiseAND" />
              <s:enumeration value="NotBitWiseOR" />
              <s:enumeration value="NotBitWiseAND" />
            </s:restriction>
          </s:simpleType>
          <s:simpleType name="ClauseOperatorType">
            <s:restriction base="s:string">
              <s:enumeration value="And" />
              <s:enumeration value="Or" />
              <s:enumeration value="Undefined" />
            </s:restriction>
          </s:simpleType>
          <s:simpleType name="QueryFlagType">
            <s:restriction base="s:string">
              <s:enumeration value="CountAll" />
              <s:enumeration value="Distinct" />
            </s:restriction>
          </s:simpleType>
          <s:complexType name="ArrayOfGetEntityOutMsg">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="GetEntityOutMsg" nillable="true" type="s1:GetEntityOutMsg" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="GetEntityOutMsg">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericOutMsg">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="unbounded" name="SerializedEntities" type="s1:SerializedEntity" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
          <s:element name="GetEntityResponse" type="s1:GetEntityResponse" />
          <s:complexType name="GetEntityResponse">
            <s:complexContent mixed="false">
              <s:extension base="s1:GenericResponse">
                <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" name="EntityList" type="s1:ArrayOfGetEntityOutMsg" />
                </s:sequence>
              </s:extension>
            </s:complexContent>
          </s:complexType>
        </s:schema>
      </wsdl:types>
      <wsdl:message name="GetSearchableAttributesSoapIn">
        <wsdl:part name="parameters" element="tns:GetSearchableAttributes" />
      </wsdl:message>
      <wsdl:message name="GetSearchableAttributesSoapOut">
        <wsdl:part name="parameters" element="tns:GetSearchableAttributesResponse" />
      </wsdl:message>
      <wsdl:message name="GetSearchableAttributesRequestHeader">
        <wsdl:part name="RequestHeader" element="tns:RequestHeader" />
      </wsdl:message>
      <wsdl:message name="GetSearchableAttributesResponseHeader">
        <wsdl:part name="ResponseHeader" element="tns:ResponseHeader" />
      </wsdl:message>
      <wsdl:message name="GetEntitySoapIn">
        <wsdl:part name="parameters" element="tns:GetEntity" />
      </wsdl:message>
      <wsdl:message name="GetEntitySoapOut">
        <wsdl:part name="parameters" element="tns:GetEntityResponse" />
      </wsdl:message>
      <wsdl:message name="GetEntityRequestHeader">
        <wsdl:part name="RequestHeader" element="tns:RequestHeader" />
      </wsdl:message>
      <wsdl:message name="GetEntityResponseHeader">
        <wsdl:part name="ResponseHeader" element="tns:ResponseHeader" />
      </wsdl:message>
      <wsdl:portType name="GetEntityWebServiceSoap">
        <wsdl:operation name="GetSearchableAttributes">
          <wsdl:input message="tns:GetSearchableAttributesSoapIn" />
          <wsdl:output message="tns:GetSearchableAttributesSoapOut" />
        </wsdl:operation>
        <wsdl:operation name="GetEntity">
          <wsdl:input message="tns:GetEntitySoapIn" />
          <wsdl:output message="tns:GetEntitySoapOut" />
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="GetEntityWebServiceSoap" type="tns:GetEntityWebServiceSoap">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="GetSearchableAttributes">
          <soap:operation soapAction="http://www.company.com/Soa/Foundation/GetSearchableAttributes" style="document" />
          <wsdl:input>
            <soap:body use="literal" />
            <soap:header message="tns:GetSearchableAttributesRequestHeader" part="RequestHeader" use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
            <soap:header message="tns:GetSearchableAttributesResponseHeader" part="ResponseHeader" use="literal" />
          </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="GetEntity">
          <soap:operation soapAction="http://www.company.com/Soa/Foundation/GetEntity" style="document" />
          <wsdl:input>
            <soap:body use="literal" />
            <soap:header message="tns:GetEntityRequestHeader" part="RequestHeader" use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
            <soap:header message="tns:GetEntityResponseHeader" part="ResponseHeader" use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:binding name="GetEntityWebServiceSoap12" type="tns:GetEntityWebServiceSoap">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="GetSearchableAttributes">
          <soap12:operation soapAction="http://www.company.com/Soa/Foundation/GetSearchableAttributes" style="document" />
          <wsdl:input>
            <soap12:body use="literal" />
            <soap12:header message="tns:GetSearchableAttributesRequestHeader" part="RequestHeader" use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap12:body use="literal" />
            <soap12:header message="tns:GetSearchableAttributesResponseHeader" part="ResponseHeader" use="literal" />
          </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="GetEntity">
          <soap12:operation soapAction="http://www.company.com/Soa/Foundation/GetEntity" style="document" />
          <wsdl:input>
            <soap12:body use="literal" />
            <soap12:header message="tns:GetEntityRequestHeader" part="RequestHeader" use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap12:body use="literal" />
            <soap12:header message="tns:GetEntityResponseHeader" part="ResponseHeader" use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="GetEntityWebService">
        <wsdl:port name="GetEntityWebServiceSoap" binding="tns:GetEntityWebServiceSoap">
          <soap:address location="http://10.0.1.5/WebServices/GetEntityWebService.asmx" />
        </wsdl:port>
        <wsdl:port name="GetEntityWebServiceSoap12" binding="tns:GetEntityWebServiceSoap12">
          <soap12:address location="http://10.0.1.5/WebServices/GetEntityWebService.asmx" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    
    requires/feedback 
    opened by bmiller264 17
  • WSDL service element should be optional

    WSDL service element should be optional

    Using zeep, I can't parse the ONVIF devicemgmt.wsdl file:

    python -m zeep http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl
    
    zeep.exceptions.XMLParseError: References from this schema ('http://www.onvif.org/ver10/schema') to components in the namespace 'http://www.w3.org/2001/XMLSchema' are not allowed, since not indicated by an import statement.
    

    I'm pretty sure the ONVIF spec uses valid WSDL/XML.

    bug component/xsd 
    opened by mattpepin 17
  • Unable to remove tags

    Unable to remove tags

    Thank you for this much needed library.

    The issue I am finding is that Zeep is sending all the tags available for a specific method. The server will throw an exception unless certain tags are removed. I dig into the documentation and unable to know how or if this is possible with Zeep

    Zeep version 0.24

    WSDL

    https://gist.github.com/isidrov/24b73e5a8499f02d92c6f566148f3375

    Example script

    https://gist.github.com/isidrov/408ee6ba3914432287a0f235bdf50691

    What I am actually sending with current script

    https://gist.github.com/isidrov/047dace78d9e83ba337f602cf31b567f

    **What I need to send to make it work (confirmed by SOAPUI) **

    https://gist.github.com/isidrov/fd47320ac5312c707600db83d055b938

    Let me know if anything else is needed.

    Thanks!

    requires/example-script 
    opened by isidrov 16
  • nillable elements not serialized correctly

    nillable elements not serialized correctly

    Looks like there's an issue with nillable elements where objects that are None get converted to '' which then throws an error when being serialized. Given a message with either of these elements:

    <s:element minOccurs="1" maxOccurs="1" name="LongId" nillable="true" type="s:long"/>
    <s:element minOccurs="1" maxOccurs="1" name="DateOfBirth" nillable="true" type="s:dateTime"/>
    

    An error will be thrown as follows:

    zeep.exceptions.Fault: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 954). ---> System.FormatException: The string '' is not a valid AllXsd value.
       at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
       at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read10_NullableOfDateTime(Boolean checkType)
    

    I have not dug deeply into the issue but I would assume the same is the case for all types, not just those two.

    component/xsd requires/more-info 
    opened by wolfadactyl 14
  • Possible bug for schema elements without targetNamespace

    Possible bug for schema elements without targetNamespace

    I am trying to get a WSDL file from a 3rd party company to work. During parsing zeep fails to properly map some messages and therefore some operations (See details below). From what I can gather is that the main problem seems to be that the xsd:element for Add has no targetNamespace and when resolving zeep prefixes with the targetNamespace of wsdl:definitions: https://github.com/mvantellingen/python-zeep/blob/c39197853e681fea773d5f6265b5971cfdf879d7/src/zeep/wsdl/parse.py#L36-L43

    I am not sure if this is a bug in zeep or the WSDL, I can neither find a definitive answer in the XML Schema specs, nor in the WSDL ones. What I was able to find is from ws-i (http://www.ws-i.org/Profiles/BasicProfile-1.1.html#Schema_targetNamespace_Structure):

     R2105 All xsd:schema elements contained in a wsdl:types element of a DESCRIPTION MUST have a targetNamespace attribute with a valid and non-null value, UNLESS the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s). 
    

    But I do not know if the targetNamespace from the wsdl:definitions should get inherited. I'll happily try to code a patch in zeep if you think this is a bug in zeep.

    Version: zeep==3.1.0 WSDL: https://apolloner.eu/~apollo13/Calculator.wsdl Example Script:

    from lxml import etree
    from zeep import Client
    
    client = Client('https://apolloner.eu/~apollo13/Calculator.wsdl')
    
    node = client.create_message(client.service, 'Add', [], {'a': 3, 'b': 4})
    
    print(etree.tostring(node, pretty_print=True))
    

    Output:

    /home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/wsdl.py:338: UserWarning: The wsdl:message for '{http://Example.org}ICalculator_Add_InputMessage' contains an invalid part ('parameters'): invalid xsd type or elements
      warnings.warn(str(exc))
    /home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/wsdl.py:338: UserWarning: The wsdl:message for '{http://Example.org}ICalculator_Add_OutputMessage' contains an invalid part ('parameters'): invalid xsd type or elements
      warnings.warn(str(exc))
    /home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/definitions.py:130: UserWarning: The wsdl:operation 'Add' was not found in the wsdl:portType '{http://Example.org}ICalculator'
      warnings.warn(str(exc))
    Forcing soap:address location to HTTPS
    Traceback (most recent call last):
      File "/home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/definitions.py", line 149, in get
        return self._operations[key]
    KeyError: 'Add'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/florian/test.py", line 8, in <module>
        client.service, 'Add', [], {'a': 3, 'b': 4})
      File "/home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/client.py", line 131, in create_message
        operation_name, args, kwargs, client=self)
      File "/home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py", line 63, in _create
        operation_obj = self.get(operation)
      File "/home/florian/dev/bap/bap-services/.venv/lib/python3.6/site-packages/zeep/wsdl/definitions.py", line 151, in get
        raise ValueError("No such operation %r on %s" % (key, self.name))
    ValueError: No such operation 'Add' on {http://Example.org}DefaultBinding_ICalculator
    
    requires/feedback 
    opened by apollo13 13
  • Setting xsi:type attribute on

    Setting xsi:type attribute on "anyType" elements and adding xsi namespace to requests?

    Hello!

    I am currently trying to generate the proper XML format for a specific "Any Type" element within my requests using Zeep.

    The WSDL of this element is:

    <xs:complexType name="Property">
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:sequence>
        <xs:element minOccurs="0" name="Value" type="xs:anyType"/>
      </xs:sequence>
    </xs:complexType>
    

    I have verified that the proper working format (in the case where the value is a string) for the resulting XML is something like:

    <Property Name="details">
        <Value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Some Text</Value>
    </Property>
    

    I am however unable to ensure the xmlsn:xs and xsi:type attributes are present in the XML contents that Zeep generates.

    With many attempts, the closest I've been able to get was:

    <Property Name="details">
        <Value>Some Text</Value>
    </Property>
    

    I've been playing around with AnyObject, ComplexType, AnyType and other elements of the Zeep library without success.

    I am basically looking for pointers on how to properly add those two missing attributes to my Value element and how to properly add the "xsi" namespace to the SOAP envelope.

    Zeep version: 0.18.1, installed via pip

    Thank you.

    bug requires/feedback 
    opened by ginmrt 13
  • Failure to parse WSDL

    Failure to parse WSDL "No definition" ... "found"

    1. The version of zeep (or if you are running master the commit hash/date)
        In [67]: zeep.__version__
        Out[75]: 
        '0.25.0'
    
    
    1. The WSDL you are using

    System.wsdl found in

    https://support.travelport.com/webhelp/uapi/Content/Resources/uAPI_WSDLschema_Release-V16.4.0.17.zip

    1. An example script
    import zeep
    
    c = zeep.Client('Release-V16.4.0.17-V16.4/system_v32_0/System.wsdl')
    
    
    $ python zeepfail.py
    Traceback (most recent call last):
      File "zeepfail.py", line 3, in <module>
        c = zeep.Client('Release-V16.4.0.17-V16.4/system_v32_0/System.wsdl')
      File "/fbpy/env/lib/python3.6/site-packages/zeep/client.py", line 100, in __init__
        self.wsdl = Document(wsdl, self.transport)
      File "/fbpy/env/lib/python3.6/site-packages/zeep/wsdl/wsdl.py", line 58, in __init__
        root_definitions.resolve_imports()
      File "/fbpy/env/lib/python3.6/site-packages/zeep/wsdl/wsdl.py", line 195, in resolve_imports
        binding.resolve(self)
      File "/fbpy/env/lib/python3.6/site-packages/zeep/wsdl/definitions.py", line 102, in resolve
        self.port_type = definitions.get('port_types', self.port_name.text)
      File "/fbpy/env/lib/python3.6/site-packages/zeep/wsdl/wsdl.py", line 175, in get
        raise IndexError("No definition %r in %r found" % (key, name))
    IndexError: No definition '{http://www.travelport.com/service/system_v32_0}SystemPingPortType' in 'port_types' found
    
    requires/feedback 
    opened by mattharrison 12
  • Force ns0 removal from envelope sent

    Force ns0 removal from envelope sent

    I'm having an issue when using zeep-python, the envelope sent has a bunch of ns0 added as namespacing.

    I tried using the etree.register_namespace() method but it doesn't seems to apply it to the envelope.

    I'm using fiddler to debug, so here's what doesn't work, and what's working :

    Not working:

    `

    <soap-env:Envelope xmlns:ns0="http://www.myurl.com/Integration/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> soap-env:Body ns0:GetList <ns0:entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:Employee"> <ns0:ID xsi:nil="true"/> ns0:Deletefalse </ns0:entity> ns0:returnFullEntitiesfalse</ns0:returnFullEntities> </ns0:GetList> </soap-env:Body> </soap-env:Envelope> `

    Working :

    `

    <soap-env:Envelope xmlns="http://www.myurl.com/Integration/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> soap-env:Body false false </soap-env:Body> </soap-env:Envelope> `

    My python code

    ` from zeep import Client from zeep.transports import Transport from lxml import etree from xml.etree import ElementTree as etree

    transport = Transport(verify=False) wsdl = 'https://my.urlcom/Integration/?WSDL' #Private wsdl client = Client(wsdl, transport=transport) etree.register_namespace("", "http://www.myurl.com/Integration/") client.service.Login('username', 'password', 'schema', 'smtn', 'EN-US') #need to login (works with the ns0 added)

    DepartmentCls = client.get_type('ns0:Department') department = DepartmentCls() department["Delete"] = False resDepartments = client.service.GetList(department, False) #crashes `

    Here's the output :

    zeep.exceptions.Fault: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at PX.Api.ContractBased.Soap.EntityTransformExtension.AddListField(XmlDocument document, String entityType, FieldNode field, XmlNode fieldElementValue, XmlAttribute typeAttribute, XmlElement fieldElement) at PX.Api.ContractBased.Soap.EntityTransformExtension.AddFields(XmlDocument document, XmlNode entity, IEnumerable1 fields, String entityType) at PX.Api.ContractBased.Soap.EntityTransformExtension.TransformEntityNode(XmlDocument document, XmlNode entity, String parent, String fieldName, String type) at PX.Api.ContractBased.Soap.EntityTransformExtension.TransformInputMessage(XmlDocument document) at PX.Api.ContractBased.Soap.EntityTransformExtension.TransformInputMessage(XmlReader input, XmlWriter output, String oldNamespace, String newNamespace) at PX.Api.ContractBased.Soap.EntityTransformExtension.TransformSoapMessage(XmlReader input, XmlWriter output, String oldNamespace, String newNamespace, Action4 transformer) at PX.Api.ContractBased.Soap.EntityTransformExtension.ProcessMessage(SoapMessage message) at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() --- End of inner exception stack trace --- Process finished with exit code 1

    Any help would be appreciated

    requires/more-info 
    opened by wmehanna 12
  • Arrays/sequences transferred incomplete (empty) to the server

    Arrays/sequences transferred incomplete (empty) to the server

    This issue is maybe somewhat releated to #145. However the former issue has already been closed so I hope you don't mind if I open a new one.

    I have currently the problem that arrays/sequences are sent empty to the server:

    WSDL (partly):

      <wsdl:message name="save_master_data">
        <wsdl:part name="atk" type="xsd:string">
        </wsdl:part>
        <wsdl:part name="type" type="xsd:string">
        </wsdl:part>
        <wsdl:part name="data" type="tns:masterObjectDataArray">
        </wsdl:part>
      </wsdl:message>
    
      <xs:complexType final="#all" name="masterObjectDataArray">
        <xs:sequence>
          <xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="tns:masterObjectData"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:complexType name="masterObjectData">
        <xs:sequence>
          <xs:element name="id" type="xs:long"/>
          <xs:element minOccurs="0" name="name" type="xs:string"/>
          <xs:element name="alive" type="xs:boolean"/>
          <xs:element minOccurs="0" name="custom" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    

    Method called:

    objects = [
     client.type_factory('ns0').masterObjectData(id=1, name="Object1", alive=true, custom=""),
     client.type_factory('ns0').masterObjectData(id=2, name="Object2", alive=true, custom=""),
     client.type_factory('ns0').masterObjectData(id=3, name="Object3", alive=true, custom="")
    ]
    client.save_master_data("foo", "bar", objects)
    

    Request beeing sent:

    <soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope">
      <soap-env:Body>
        <ns0:save_master_data xmlns:ns0="http://example">
          <atk>foo</atk>
          <type>bar</type>
          <data/>
        </ns0:save_master_data>
      </soap-env:Body>
    </soap-env:Envelope>
    

    Python Debug (generation of objects seems to be successfull):

    print(repr(objects))
    #==>
    [{
        'id': 1,
        'name': 'Object1',
        'alive': True,
        'custom': "" },
    {
        'id': 2,
        'name': 'Object2',
        'alive': True,
        'custom': "" },
    [...] ]
    

    Expected (afaik):

    <soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope">
      <soap-env:Body>
        <ns0:save_master_data xmlns:ns0="http://example">
          <atk>foo</atk>
          <type>bar</type>
          <data>
           <masterObjectData>
             <id>1</id>
             <name>Object1</name>
             <custom></custom>
           </masterObjectData>
            <masterObjectData>
              <id>2</id>
              <name>Object2</name>
              <custom></custom>
            </masterObjectData>
    [...]
          </data>
        </ns0:save_master_data>
      </soap-env:Body>
    </soap-env:Envelope>
    
    requires/example-script 
    opened by Flauschbaellchen 11
  • RecursionError: maximum recursion depth exceeded while calling a Python object

    RecursionError: maximum recursion depth exceeded while calling a Python object

    I am using zeep==4.1.0 (Conda, Python 3.10) and experience a weird issue:

    Only in debug-mode (PyCharm), zeep will throw me the following RecursionError

      ...
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/elements/element.py", line 232, in render
        self._render_value_item(parent, value, render_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/elements/element.py", line 255, in _render_value_item
        return value._xsd_type.render(node, value, xsd_type, render_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/types/complex.py", line 295, in render
        element.render(node, element_value, child_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/elements/indicators.py", line 251, in render
        element.render(parent, element_value, child_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/elements/element.py", line 232, in render
        self._render_value_item(parent, value, render_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/elements/element.py", line 255, in _render_value_item
        return value._xsd_type.render(node, value, xsd_type, render_path)
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/types/complex.py", line 273, in render
        and not isinstance(value, (list, dict, CompoundValue))
      File "/home/sfalk/miniconda3/envs/ris-sync/lib/python3.10/site-packages/zeep/xsd/valueobjects.py", line 150, in __getattribute__
        def __getattribute__(self, key):
    RecursionError: maximum recursion depth exceeded while calling a Python object
    python-BaseException
    

    I am simply running the following code in debug mode:

    import zeep
    
    def main():
        wsdl = "https://data.bka.gv.at/ris/ogd/v2.6/ogdrisservice.asmx?WSDL"
        client = zeep.Client(wsdl=wsdl)
        print(client.service.Version())
        result = client.service.SearchDocuments(
            {
                "Suche": {
                    "Judikatur": {
                        "Vfgh": {}
                    }
                }
            }
        )
        print(result)
    
        print("All done.")
    
    if __name__ == '__main__':
        main()
    
    opened by falk-stefan 0
  • WsAddressingPlugin uses fixed namespace version 2005. Server expects version 2004

    WsAddressingPlugin uses fixed namespace version 2005. Server expects version 2004

    Hello,

    Currently the WsAddressingPlugin uses a fixed reference to http://www.w3.org/2005/08/addressing from ns.py for the WSA namespace.

    The server that implements the api expects the older version of the WSA namespace (http://schemas.xmlsoap.org/ws/2004/08/addressing) for services at https://service-test.swisspost.ch/Cert/ArchiveServices/DocServices.asmx?WSDL and reports an error.

    It would be very helpful to be able to select or override the version.

    Thanks and best regards

    opened by rlc61 0
  • Using specific port returns 403 from server

    Using specific port returns 403 from server

    Hello everyone,

    I have an issue with accessing the WSDL interface on port 8080 with our corporate proxy. It seems like Zeep still tries access it on 80 port, which is not allowed for connections, thats why I receive a 403 Forbidden error.

    Is there any way to force the port 8080?

    My Zeep version is 4.1.0

    My code:

    proxies = { 'http': 'proxy:port'}
    
    session = Session()
    session.proxies = proxies
    session.verify = False
    settings = Settings(force_https=False)
    transport = Transport(session=session)
    
    client = Client('http://soap.host.com:8080/folder/script.php?WSDL', transport=transport, settings=settings)
    
    client.service.openService(args)
    
    Content: b'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don\'t have permission to access /folder/script.php\non this server.</p>\n</body></html>\n'
    

    The same happens if I try to make a curl request without specifying the 8080 port.

    Thank you!

    opened by skilletti 1
  • Soap Headers, pass an lxml Element object when the wsdl doesn’t define it but the server expects it?

    Soap Headers, pass an lxml Element object when the wsdl doesn’t define it but the server expects it?

    I've had a long-standing question on Stackoverflow regarding this question, but have not found a solution/answer here, 7k views.

    The basics issue is that the api has both an authentication and a paging mechanism that are not defined in the wsdl. Authentication does work by providing a custom xsd.Element. Solutions manually defining the xsd.Element for pager have not worked since the wsdl does not appear to expect it.

    API Docs:

    Pagination; this method returns paginated results. To specify pages or results per page, use the pager header:

      <ns:pager>
        <page>1</page>
        <per_page>100</per_page>
      </ns:pager>
    </soapenv:Header>
    

    Max per page is 100

    Pagination information is returned in a pager header:

    <soapenv:Header>
      <ns:pager>
        <page>1</page>
        <per_page>100</per_page>
        <next_page>2</next_page>
        <page_items>100</page_items>
        <total_items>2829</total_items>
        <total_pages>29</total_pages>
      </ns:pager>
    </soapenv:Header>
    

    A header snippet provided by the API developer:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns="https://api.redacted.net/2.0/">
       <soapenv:Header>
         <ns:apiKey>
            <api_key>***</api_key>
         </ns:apiKey>
         <pager>
            <page>2</page>
            <per_page>10</per_page>
         </pager>
       </soapenv:Header>
       <soapenv:Body>
          <ns:getCaseUpdates>
             <case_id>2038217180</case_id>
          </ns:getCaseUpdates>
       </soapenv:Body>
    </soapenv:Envelope>
    

    Zeep Soap Headers docs page provides a note for an alternative solution. The SO question which does address use of lxml appears to replace the Header element completely. This won't work since the API requires authentication through the Header as well, and that part is currently working (again even though it is not defined in the wsdl).

    "4. Another option is to pass an lxml Element object. This is generally useful if the wsdl doesn’t define a soap header but the server does expect it."

    Could you direct me to an example for this method, or if possible help with an answer to the SO question?

    Thank you for your time and work on this project.

    opened by johnziebro 3
  • How to remove extra element when using _soapheaders=[...]

    How to remove extra element when using _soapheaders=[...]

    Hi All,

    I've been trying to use the xsd.Element to customize the header via _soapheaders. But it creates a new element Header under the <s:Header> that already exists.

    Any Idea how to avoid this problem?

    The new header is created using the code below.

    header = xsd.Element(
        'Header',
        xsd.ComplexType(
            xsd.Sequence([
                xsd.Element(
                    name='{http://schemas.xmlsoap.org/ws/2004/08/addressing}Action',
                    type_=xsd.String()
                ),
                xsd.Element(
                    name='{http://schemas.xmlsoap.org/ws/2004/08/addressing}To',
                    type_=xsd.String()
                ),
                xsd.Element(
                    name='fueloauth',
                    type_=xsd.String()
                )
            ])
        )
        # attr_name="Header",
        # is_global=True
    )
    header_value = header(Action="Retrieve", To=url_amsx, fueloauth=token)
    

    output:

    <s:Header>
            <Header>
                <a:Action s:mustUnderstand="1">Retrieve</a:Action>
                <a:To s:mustUnderstand="1"
    

    Thank you

    opened by antonio83moura 0
Releases(4.1.0)
  • 4.1.0(Aug 15, 2021)

    • Remove last dependency on six (#1250)
    • Use platformdirs instead of the appsdirs dependency (#1244)
    • Pass digest method when signing timestamp node(#1201)
    • Fix settings context manager when an exception is raised (#1193)
    • Don't render decimals using scientific notation (#1191)
    • Remove dependency on defusedxml (deprecated) (#1179)
    • Improve handling of str values for Duration (#1165)
    Source code(tar.gz)
    Source code(zip)
Owner
Michael van Tellingen
:collision:
Michael van Tellingen
Python requests like API built on top of Twisted's HTTP client.

treq: High-level Twisted HTTP Client API treq is an HTTP library inspired by requests but written on top of Twisted's Agents. It provides a simple, hi

Twisted Matrix Labs 541 May 4, 2022
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie

HTTPie: human-friendly CLI HTTP client for the API era HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI in

HTTPie 21.7k May 27, 2022
Small, fast HTTP client library for Python. Features persistent connections, cache, and Google App Engine support. Originally written by Joe Gregorio, now supported by community.

Introduction httplib2 is a comprehensive HTTP client library, httplib2.py supports many features left out of other HTTP libraries. HTTP and HTTPS HTTP

null 441 May 15, 2022
A toolbelt of useful classes and functions to be used with python-requests

The Requests Toolbelt This is just a collection of utilities for python-requests, but don't really belong in requests proper. The minimum tested reque

null 843 May 16, 2022
Asynchronous Python HTTP Requests for Humans using Futures

Asynchronous Python HTTP Requests for Humans Small add-on for the python requests http library. Makes use of python 3.2's concurrent.futures or the ba

Ross McFarland 1.9k May 25, 2022
🔄 🌐 Handle thousands of HTTP requests, disk writes, and other I/O-bound tasks simultaneously with Python's quintessential async libraries.

?? ?? Handle thousands of HTTP requests, disk writes, and other I/O-bound tasks simultaneously with Python's quintessential async libraries.

Hackers and Slackers 9 Apr 28, 2022
A Python obfuscator using HTTP Requests and Hastebin.

?? Jawbreaker ?? Jawbreaker is a Python obfuscator written in Python3, using double encoding in base16, base32, base64, HTTP requests and a Hastebin-l

Billy 42 May 15, 2022
Single-file replacement for python-requests

mureq mureq is a single-file, zero-dependency replacement for python-requests, intended to be vendored in-tree by Linux systems software and other lig

Shivaram Lingamneni 254 May 18, 2022
r - a small subset of Python Requests

r a small subset of Python Requests a few years ago, when I was first learning Python and looking for http functionality, i found the batteries-includ

Gabriel Sroka 2 Feb 8, 2022
Requests + Gevent = <3

GRequests: Asynchronous Requests GRequests allows you to use Requests with Gevent to make asynchronous HTTP Requests easily. Note: You should probably

Spencer Phillip Young 4k May 23, 2022
EasyRequests is a minimalistic HTTP-Request Library that wraps aiohttp and asyncio in a small package that allows for sequential, parallel or even single requests

EasyRequests EasyRequests is a minimalistic HTTP-Request Library that wraps aiohttp and asyncio in a small package that allows for sequential, paralle

Avi 1 Jan 27, 2022
Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.

Paweł Piotr Przeradowski 8.6k May 18, 2022
A next generation HTTP client for Python. 🦋

HTTPX - A next-generation HTTP client for Python. HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support

Encode 8.8k May 25, 2022
Asynchronous HTTP client/server framework for asyncio and Python

Async http client/server framework Key Features Supports both client and server side of HTTP protocol. Supports both client and server Web-Sockets out

aio-libs 12.4k May 25, 2022
Aiosonic - lightweight Python asyncio http client

aiosonic - lightweight Python asyncio http client Very fast, lightweight Python asyncio http client Here is some documentation. There is a performance

Johanderson Mogollon 70 May 11, 2022
A minimal HTTP client. ⚙️

HTTP Core Do one thing, and do it well. The HTTP Core package provides a minimal low-level HTTP client, which does one thing only. Sending HTTP reques

Encode 261 May 18, 2022
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie

HTTP Prompt HTTP Prompt is an interactive command-line HTTP client featuring autocomplete and syntax highlighting, built on HTTPie and prompt_toolkit.

HTTPie 8.5k May 27, 2022
Fast HTTP parser

httptools is a Python binding for the nodejs HTTP parser. The package is available on PyPI: pip install httptools. APIs httptools contains two classes

magicstack 1k May 14, 2022
Python package for caching HTTP response based on etag

Etag cache implementation for HTTP requests, to save request bandwidth for a non-modified response. Returns high-speed accessed dictionary data as cache.

Rakesh R 2 Apr 27, 2022