utils/soap: look for custom transport class in ressource (#31612)

This commit is contained in:
Frédéric Péters 2019-03-21 09:27:17 +01:00
parent a82e3df74b
commit c2bf9eb3b0
1 changed files with 4 additions and 2 deletions

View File

@ -294,7 +294,8 @@ class SOAPTransport(Transport):
disable basic_authentication hosts unrelated to wsdl's endpoints
"""
def __init__(self, wsdl_url, **kwargs):
def __init__(self, resource, wsdl_url, **kwargs):
self.resource = resource
self.wsdl_host = urlparse.urlparse(wsdl_url).netloc
super(SOAPTransport, self).__init__(**kwargs)
@ -313,7 +314,8 @@ class SOAPClient(Client):
"""
def __init__(self, resource, **kwargs):
wsdl_url = kwargs.pop('wsdl_url', None) or resource.wsdl_url
transport = SOAPTransport(wsdl_url, session=resource.requests, cache=InMemoryCache())
transport_class = getattr(resource, 'soap_transport_class', SOAPTransport)
transport = transport_class(resource, wsdl_url, session=resource.requests, cache=InMemoryCache())
super(SOAPClient, self).__init__(wsdl_url, transport=transport, **kwargs)