Registry /
crm-productivity / salesforce-fuelsdk-sans
Install & Compatibility
Where this runs
tested against v1.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.484s · 23MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.434s · 23MB
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ET_Client
✓ from FuelSDK import ET_Client
✗ from salesforce_fuelsdk_sans import ET_Client
The primary client class is exposed directly under the `FuelSDK` namespace, mimicking the original SDK's import path.
This quickstart demonstrates how to initialize the `ET_Client` and perform a basic API call, such as creating a new list. It relies on environment variables for authentication credentials, which is a recommended practice. The `ET_Client` manages access token acquisition and refresh automatically.
import os
from FuelSDK import ET_Client
# Configure environment variables (recommended for production)
# export FUELSDK_CLIENT_ID='YOUR_CLIENT_ID'
# export FUELSDK_CLIENT_SECRET='YOUR_CLIENT_SECRET'
# export FUELSDK_AUTH_URL='YOUR_AUTH_TENANT_SPECIFIC_ENDPOINT'
# export FUELSDK_BASE_API_URL='YOUR_REST_TENANT_SPECIFIC_ENDPOINT'
# export FUELSDK_SOAP_ENDPOINT='YOUR_SOAP_TENANT_SPECIFIC_ENDPOINT'
try:
# Initialize ET_Client. Pass False for debug, False for account_id (unless using multi-org)
# Configuration can be passed as a dictionary, read from ~/.fuelsdk/config.python,
# or via environment variables (as shown below).
myClient = ET_Client(False, False)
# Example: Retrieve a list of lists
etList = myClient.create_object('List')
etList.props = {'Name': 'My New List', 'Description': 'Created via FuelSDK-Sans'}
results = etList.post()
if results.status:
print(f"Successfully created list: {results.results[0]['NewID']}")
else:
print(f"Error creating list: {results.results[0]['ErrorMessage']}")
print(f"Full response: {results.results}")
# Example: Get all lists
# etList = myClient.create_object('List')
# results = etList.get()
# if results.status:
# print(f"Found {len(results.results)} lists.")
# for lst in results.results:
# print(f" List Name: {lst['ListName']}, ID: {lst['ID']}")
# else:
# print(f"Error retrieving lists: {results.results[0]['ErrorMessage']}")
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure environment variables or config file are correctly set.")
Debug
Known issues
breakingVersion 1.3.1 replaced `suds-jurko` with `suds-community` as a dependency due to `setuptools>=58.0.0` no longer supporting `2to3`. If you are upgrading from an older version of the original FuelSDK-Python or salesforce-fuelsdk-sans and explicitly relied on `suds-jurko`, you might encounter dependency resolution issues.fixEnsure `suds-jurko` is uninstalled and `suds-community` is installed (e.g., `pip install suds-community`). Update your `requirements.txt` to reflect `suds-community>=0.7` and remove `suds-jurko`.
affects: <1.3.1
gotchaAuthentication is a common source of errors. Incorrectly configured Client ID, Client Secret, or tenant-specific endpoints (`authenticationurl`, `baseapiurl`, `soapendpoint`) can lead to 'Unable to validate App Keys' or 'unsupported_grant_type' errors. Ensure these values are correct for your Marketing Cloud instance and application type.fixVerify all authentication parameters against your Marketing Cloud Installed Package details. Utilize environment variables (e.g., `FUELSDK_CLIENT_ID`, `FUELSDK_CLIENT_SECRET`) or a `config.python` file, or pass them directly to the `ET_Client` constructor.
affects: All
gotchaThe `ET_Client` object should be instantiated once and reused for the entire session. Creating a new `ET_Client` object for each API request can lead to performance overhead and potential issues with token management and endpoint determination.fixTreat the `ET_Client` instance as a singleton within your application's session, reusing the same object for all API interactions.
affects: All
gotchaThe original `FuelSDK-Python` (before this fork) was reported to have compatibility issues with Python 3.10 and newer versions. While `salesforce-fuelsdk-sans` aims to address this, users migrating from the original SDK should be aware of potential runtime errors if they haven't upgraded to this maintained fork.fixEnsure you are using `salesforce-fuelsdk-sans` (version 1.3.1 or newer) for compatibility with modern Python versions.
affects: Original FuelSDK-Python on Python >=3.10
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'salesforce_fuelsdk_sans'
Despite the package name `salesforce-fuelsdk-sans`, the main module containing `ET_Client` is named `FuelSDK` internally, leading to incorrect import attempts.
fixUse `from FuelSDK import ET_Client` to import the client correctly after installing the package.
Fuel SDK Python Token acquisition failed: {'error': 'unauthorized_client'}
The configured Client ID and Client Secret are not authorized to obtain an access token, often due to incorrect permissions on the Marketing Cloud API Integration or the associated API user.
fixVerify the Client ID, Client Secret, and ensure the associated API user in Salesforce Marketing Cloud Setup has the necessary API roles and permissions.
Fuel SDK Python Token acquisition failed: {'error': 'invalid_client', 'error_description': 'client_id is invalid'}
The provided Client ID is incorrect, does not exist, or is misspelled for the Marketing Cloud instance you are trying to connect to.
fixDouble-check the `client_id` value against the API Integration details in your Salesforce Marketing Cloud Setup.
Fuel SDK Python API Call Error: Name is required for DataExtension.
When attempting to create or update a Data Extension via the SDK, the 'Name' property was either missing from the `props` dictionary or provided with an empty value.
fixEnsure that the `Name` property is included and has a valid string value in the `props` dictionary of your `ET_DataExtension` object before making the API call (e.g., `de.props = {'CustomerKey': 'myKey', 'Name': 'My New DE'}`). Upgrade
Version history
1.3.1latest on PyPI · released Jun 20, 2022
Audit
Dependencies
PyJWTrequiredRequired for JWT-based authentication.
requestsrequiredUsed for making HTTP requests to REST APIs.
suds-communityrequiredUsed for interacting with SOAP APIs. Replaced 'suds-jurko' in v1.3.1.