Connecting to the SOAP API using Python

Why Connect to the SOAP API Using Python

Use the connection to the SOAP API to test your calls and perform various tasks, such as sending email and retrieving tracking information.

How to Connect to the SOAP API Using Python

Download both the latest version of Python Python and the Zolera SOAP infrastructure and follow the appropriate instructions to install the service on your computer. Marketing Cloud also provides a full Python SDK for use in connecting your environment and developing your projects:

Generating Client Stubs

Use the wsdl2py tool to generate Python stubs based on the Marketing Cloud WSDL.

See the WSDL To Python Code section of ZSI's User Guide.

When generating stubs for a service called PartnerAPI, the tool generates the necessary files using the command below:

Sample Code

Use the script below to generate the Python stubs, add security headers, and sends and receives a SOAP message by calling the PersonServices's getEmail() method. You must modify this code to interact with the SOAP API.

Running the Client

Use the following command to run the client: