Salesforce Marketing Cloud Fuel SDK for Python

raw JSON →
1.3.0 verified Fri May 01 auth: no python

The Salesforce Marketing Cloud Fuel SDK for Python (v1.3.0) provides a wrapper for the Salesforce Marketing Cloud SOAP and REST APIs, enabling email, audience, and data extension management. It supports OAuth2 authentication (including Public App, Web App, and refresh tokens). The SDK is in maintenance mode with infrequent releases.

pip install salesforce-fuelsdk
error ModuleNotFoundError: No module named 'fuelSDK'
cause The package is installed as 'salesforce-fuelsdk', but the import uses the module name 'fuelSDK' (note capital letters).
fix
Install with pip install salesforce-fuelsdk and import as import fuelSDK or from fuelSDK.client import FuelSDKClient.
error AttributeError: module 'fuelSDK' has no attribute 'FuelSDKClient'
cause Incorrect import path; FuelSDKClient is in the client submodule.
fix
Use from fuelSDK.client import FuelSDKClient.
breaking In v1.3.0, OAuth2 authentication changed: you must now use the new FuelSDKClient class. The old ET_Client with legacy username/password auth is deprecated and may not work in future.
fix Use FuelSDKClient with client_id, client_secret, auth_base_url, and soap_endpoint.
gotcha The import path for FuelSDKClient is `fuelSDK.client.FuelSDKClient`, not `fuelSDK.FuelSDKClient`. Many existing examples show the wrong import.
fix Use `from fuelSDK.client import FuelSDKClient`.
gotcha The SDK uses suds-jurko for SOAP, which is not thread-safe. Avoid sharing a client instance across threads without proper locking.
fix Create a new FuelSDKClient per thread or use threading locks around SOAP calls.

Initialize the SDK client using environment variables for credentials, then retrieve a list of data extensions.

from fuelSDK.client import FuelSDKClient

client = FuelSDKClient(
    client_id=os.environ.get('SFMC_CLIENT_ID', ''),
    client_secret=os.environ.get('SFMC_CLIENT_SECRET', ''),
    auth_base_url=os.environ.get('SFMC_AUTH_URL', 'https://mc.exacttarget.com'),
    soap_endpoint=os.environ.get('SFMC_SOAP_URL', '')
)

# Retrieve all data extensions
response = client.soap_client.retrieve('DataExtension', ['Name', 'CustomerKey'])
print(response)