Connecting to SOAP API using Python

Use Python sample code and language details here to connect your development environment, or other systems to the Marketing Cloud via SOAP API.

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

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:

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:

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.

Use the following command to run the client: