Skip to main content

snippets_py

Integration

New integration from credential
soap_client = yepcode.integration.soap("credential-slug");
New integration from plain data
import zeep
soap_client = zeep.Client(wsdl='http://example.com/wsdl?wsdl')

Security and Credentials

Using basic authentication with a webservice
from requests import Session
from requests.auth import HTTPBasicAuth

import zeep
from zeep.transports import Transport

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

soap_client = zeep.Client(wsdl='http://example.com/wsdl?wsdl', transport=transport_with_basic_auth)

Calling Methods

Call a method on the SOAP service
response = soap_client.my_function_name('value')
Call a method using a specific service and port
from requests import Session
from requests.auth import HTTPBasicAuth

import zeep
from zeep.transports import Transport

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

soap_client = zeep.Client(
wsdl='http://example.com/wsdl?wsdl',
transport=transport_with_basic_auth,
service_name='my_service',
port_name='my_port'
)

response = soap_client.my_function_name('value')