diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:12:37 +0000 | 
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 16:12:37 +0000 | 
| commit | 805f103cfb153b0ec0a713de0428ab1da13a308d (patch) | |
| tree | 3c0b2546f1c51a62e19526fc48d2d5ef83bd1f3b | |
| parent | 6c1524e1899d9601917612edbed108904a860cb5 (diff) | |
automatic import of python-fuelsdkwrapper
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-fuelsdkwrapper.spec | 934 | ||||
| -rw-r--r-- | sources | 1 | 
3 files changed, 936 insertions, 0 deletions
| @@ -0,0 +1 @@ +/FuelSDKWrapper-1.3.4.tar.gz diff --git a/python-fuelsdkwrapper.spec b/python-fuelsdkwrapper.spec new file mode 100644 index 0000000..5472316 --- /dev/null +++ b/python-fuelsdkwrapper.spec @@ -0,0 +1,934 @@ +%global _empty_manifest_terminate_build 0 +Name:		python-FuelSDKWrapper +Version:	1.3.4 +Release:	1 +Summary:	Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget) +License:	MIT +URL:		https://github.com/seb-angel/FuelSDK-Python-Wrapper +Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/71/04/7e2bdab3fea804106e83e322f15476c749e2911621958037d56443ee44cb/FuelSDKWrapper-1.3.4.tar.gz +BuildArch:	noarch + +Requires:	python3-Salesforce-FuelSDK +Requires:	python3-PyJWT +Requires:	python3-requests +Requires:	python3-suds-jurko + +%description +# FuelSDKWrapper +Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget). + +## Overview +The Fuel SDK Wrapper for Python adds functionalities to the default Fuel SDK and provides access to more SOAP API objects. The Fuel SDK documentation can be found [here](https://github.com/salesforce-marketingcloud/FuelSDK-Python). + +## Installation +```python +pip install FuelSDKWrapper +``` + +## Getting Started + +### Configuring + +You must configure your access tokens and details for the Fuel SDK in one of the following two ways. + +1. Copy the included `config.python.template` file to `config.python` in either `~/.fuelsdk/`, within this python module or at the root of your project. +2. Add environment variables: +    * `FUELSDK_CLIENT_ID` (required) +    * `FUELSDK_CLIENT_SECRET` (required) +    * `FUELSDK_APP_SIGNATURE` +    * `FUELSDK_DEFAULT_WSDL` +    * `FUELSDK_AUTH_URL` +    * `FUELSDK_WSDL_FILE_LOCAL_LOC` + +Edit `config.python` or declare environment variables so you can input the ClientID and Client Secret values provided when you registered your application. If you are building a HubExchange application for the Interactive Marketing Hub then, you must also provide the Application Signature (`appsignature` / `FUELSDK_APP_SIGNATURE`). +The `defaultwsdl` / `FUELSDK_DEFAULT_WSDL` configuration must be [changed depending on the ExactTarget service](https://code.exacttarget.com/question/there-any-cetificrate-install-our-server-access-et-api "ExactTarget Forum"). +The `authenticationurl` / `FUELSDK_AUTH_URL` must also be [changed depending on service](https://code.exacttarget.com/question/not-able-create-accesstoken-when-clientidsecret-associated-preproduction-account "ExactTarget Forum"). +The `wsdl_file_local_loc` / `FUELSDK_WSDL_FILE_LOCAL_LOC` allows you to specify the full path/filename where the WSDL file will be located on disk, if for instance you are connecting to different endpoints from the same server. + +If you have not registered your application or you need to lookup your Application Key or Application Signature values, please go to App Center at [Code@: ExactTarget's Developer Community](http://code.exacttarget.com/appcenter "Code@ App Center"). + + +| Environment | WSDL (default) | URL (auth) | +| ----------- | -------------- | ---------- | +| Production  | https://webservice.exacttarget.com/etframework.wsdl | https://auth.exacttargetapis.com/v1/requestToken?legacy=1 | +| Sandbox     | https://webservice.test.exacttarget.com/Service.asmx?wsdl | https://auth-test.exacttargetapis.com/v1/requestToken?legacy=1 | + + +It is also possible to pass those values directly to the API object: +```python +params = { +    "clientid": "YOUR_CLIENT_ID", +    "clientsecret": "YOUR_CLIENT_SECRET" +} +api = ET_API(params=params) +``` + +## Examples + +### Get the List objects + +```python +# Add a require statement to reference the FuelSDK functionality +from FuelSDKWrapper import ET_API, ObjectType + +# Next, create an instance of the ET_API class +api = ET_API() + +# Get the List objects +response = api.get_objects(ObjectType.LIST) + +# Print out the results for viewing +print('Post Status: {}'.format(response.status)) +print('Code: {}'.format(response.code)) +print('Message: {}'.format(response.message)) +print('Result Count: {}'.format(len(response.results))) +print('Results: {}'.format(response.results)) +``` + +### Some examples of utilization + +```python +from FuelSDKWrapper import ET_API, ObjectType, Operator, FolderType, simple_filter, complex_filter +from datetime import datetime, timedelta + +api = ET_API() + +# Get Subscriber Data using the IN Operator +response = api.get_objects( +    ObjectType.SUBSCRIBER, +    simple_filter("EmailAddress", Operator.IN, ["my.email@domain.com", "your.email@domain.com"]) +) + +# Find Query Definition using the LIKE Operator +response = api.get_objects( +    ObjectType.QUERY_DEFINITION, +    simple_filter("QueryText", Operator.LIKE, "FROM My_DE"), +    property_list=["Name", "CategoryID", "QueryText"] +) + +# Get Jobs sent in the last 30 days +start_date = datetime.now() - timedelta(days=30) +response = api.get_objects( +    ObjectType.SEND, +    simple_filter("SendDate", Operator.GREATER_THAN, start_date) +) + +# Get Folder Data +response = api.get_objects( +    ObjectType.FOLDER, +    complex_filter( +        simple_filter("Name", Operator.EQUALS, "My_Folder_Name"), +        "OR", +        simple_filter("Name", Operator.EQUALS, "My_Other_Folder_Name") +    ), +    property_list=["ID", "Name"] +) + +# Get Folder Full Path +folder_id = 12345 +response = api.get_folder_full_path(folder_id) + +# Get or Create Folder Full Path +folder_names = ["Test", "Sub_Test"] +folder_type = FolderType.DATA_EXTENSIONS +response = api.get_or_create_folder_hierarchy(folder_type, folder_names) + +# Start an Automation +response = api.start_automation("Automation_Key") + +# Seng Trigger Email +response = api.send_trigger_email("MyTriggerKey", "email@email.com", "subscriberkey@email.com", attributes={ +    "first_nm": "Sebastien", +    "birth_dt": "1/1/1990" +}) + +# Get Tokens +short_token = api.get_client().authToken +long_token = api.get_client().internalAuthToken + +# Get Data Extension Fields sorted by Ordinal +fields = sorted(api.get_data_extension_columns("My_DE_Key").results, key=lambda x: x.Ordinal) + +# Clear Data Extension +response = api.clear_data_extension("DE_Key") + +# Create Batch of Data Extension Rows +# Synchronous +keys_list = [ +    ["Field1", "Field2", "Field3"],  # Fields for Row 1 +    ["Field1", "Field2", "Field3"],  # Fields for Row 2 +    ["Field1", "Field2", "Field3"]   # Fields for Row 3 +] +values_list = [ +    ["Row1_Value1", "Row1_Value2", "Row1_Value3"], +    ["Row2_Value1", "Row2_Value2", "Row2_Value3"], +    ["Row3_Value1", "Row3_Value2", "Row3_Value3"] +] +rows_inserted_count = api.create_data_extension_rows("DE_Key", keys_list, values_list) + +# Asynchronous Insert and Upsert +items_list = [ +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 1 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 2 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"}  # Row 3 +] +res = api.create_data_extension_rows_async("DE_Key", items_list) +res = api.upsert_data_extension_rows_async("DE_Key", items_list) + +# Retrieve Data Extension Rows via REST API for more advanced parameters +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=complex_filter( +        simple_filter("first_name", Operator.EQUALS, "John"), +        'AND', +        simple_filter("last_name", Operator.EQUALS, "Doe") +    ), +    property_list=["email_address", "first_name", "last_name"], +    order_by="first_name ASC,last_name DESC", +    page_size=100, +    page=5 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("full_name", Operator.LIKE, "Jo%Doe"), +    property_list=["email_address", "full_name"], +    max_rows=300 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("first_name", Operator.IN, ["Jane", "John"]), +    top=100 +) + +# Get Email Rendered Preview +res = api.get_objects( +    ObjectType.EMAIL,  +    simple_filter("Name", Operator.EQUALS, "BCLA_202001_06-LIVE"), +    property_list=["ID"] +) +email_id = res.results[0].ID +res = api.get_email_preview( +    email_id, +    data_extension_key="My_DE_Key", +    contact_key="My_Contact_Key" +) + +# Retrieve All Subscribers List ID +# The real ID is not what is sent by the SOAP List object +all_subscribers_list_id = api.get_all_subscribers_list_id() +``` + +### Get More Results + +```python +response = api.get_objects(ObjectType.LIST_SUBSCRIBER, +                           simple_filter("ListID", Operator.EQUALS, 1234), +                           property_list=["ID"]) +total = len(response.results) +while response.more_results: +    response = api.get_more_results() +    total += len(response.results) +``` + +### Extract Request + +```python +start_date = datetime.now() - timedelta(days=30) +end_date = datetime.now() +response = api.extract_data( +    parameters={"AccountIDs": "123456", "_AsyncID": 0, +        "StartDate": start_date, "EndDate": end_date, +        "ExtractSent": "true", "ExtractSendJobs": "true", "ExtractBounces": "false", "ExtractClicks": "false", +        "ExtractOpens": "false", "ExtractUnsubs": "false", "ExtractConversions": "false", +        "IncludeTestSends": "false", "IncludeUniqueClicks": "false", "IncludeUniqueOpens": "false", +        "ExtractSurveyResponses": "false", "Format": "tab", +        "OutputFileName": "extract.zip"}) +``` + +### Perform Request + +You can Perform the list of actions found [here](https://help.marketingcloud.com/en/technical_library/web_service_guide/methods/perform/). + +```python +response = api.get_objects( +    ObjectType.IMPORT_DEFINITION, +    simple_filter("Name", Operator.EQUALS, "Import_my_file") +) +try: +    import_def = response.results[0] +    response = api.perform_action("start", import_def) +except IndexError: +    print("No Import Definition found") +``` + +### List SOAP API Object Properties + +```python +response = api.get_info(ObjectType.CONTENT_AREA) +``` + +## Responses + +All methods on Fuel SDK objects return a generic object that follows the same structure, regardless of the type of call.  This object contains a common set of properties used to display details about the request. + +| Parameter | Description                                                     | +| --------- | --------------------------------------------------------------- | +| status    | Boolean value that indicates if the call was successful         | +| code      | HTTP Error Code (will always be 200 for SOAP requests)          | +| message   | Text values containing more details in the event of an Error    | +| results   | Collection containing the details unique to the method called.  | + +## Debug + +To debug any issues, activate the debug mode: +```python +api = ET_API(debug=True) +``` + +## Requirements + +Python 2.7.x +Python 3.x + +Libraries: + +* Salesforce-FuelSDK>=1.3.0 +* PyJWT>=0.1.9 +* requests>=2.18.4 +* suds-jurko>=0.6 + + + + +%package -n python3-FuelSDKWrapper +Summary:	Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget) +Provides:	python-FuelSDKWrapper +BuildRequires:	python3-devel +BuildRequires:	python3-setuptools +BuildRequires:	python3-pip +%description -n python3-FuelSDKWrapper +# FuelSDKWrapper +Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget). + +## Overview +The Fuel SDK Wrapper for Python adds functionalities to the default Fuel SDK and provides access to more SOAP API objects. The Fuel SDK documentation can be found [here](https://github.com/salesforce-marketingcloud/FuelSDK-Python). + +## Installation +```python +pip install FuelSDKWrapper +``` + +## Getting Started + +### Configuring + +You must configure your access tokens and details for the Fuel SDK in one of the following two ways. + +1. Copy the included `config.python.template` file to `config.python` in either `~/.fuelsdk/`, within this python module or at the root of your project. +2. Add environment variables: +    * `FUELSDK_CLIENT_ID` (required) +    * `FUELSDK_CLIENT_SECRET` (required) +    * `FUELSDK_APP_SIGNATURE` +    * `FUELSDK_DEFAULT_WSDL` +    * `FUELSDK_AUTH_URL` +    * `FUELSDK_WSDL_FILE_LOCAL_LOC` + +Edit `config.python` or declare environment variables so you can input the ClientID and Client Secret values provided when you registered your application. If you are building a HubExchange application for the Interactive Marketing Hub then, you must also provide the Application Signature (`appsignature` / `FUELSDK_APP_SIGNATURE`). +The `defaultwsdl` / `FUELSDK_DEFAULT_WSDL` configuration must be [changed depending on the ExactTarget service](https://code.exacttarget.com/question/there-any-cetificrate-install-our-server-access-et-api "ExactTarget Forum"). +The `authenticationurl` / `FUELSDK_AUTH_URL` must also be [changed depending on service](https://code.exacttarget.com/question/not-able-create-accesstoken-when-clientidsecret-associated-preproduction-account "ExactTarget Forum"). +The `wsdl_file_local_loc` / `FUELSDK_WSDL_FILE_LOCAL_LOC` allows you to specify the full path/filename where the WSDL file will be located on disk, if for instance you are connecting to different endpoints from the same server. + +If you have not registered your application or you need to lookup your Application Key or Application Signature values, please go to App Center at [Code@: ExactTarget's Developer Community](http://code.exacttarget.com/appcenter "Code@ App Center"). + + +| Environment | WSDL (default) | URL (auth) | +| ----------- | -------------- | ---------- | +| Production  | https://webservice.exacttarget.com/etframework.wsdl | https://auth.exacttargetapis.com/v1/requestToken?legacy=1 | +| Sandbox     | https://webservice.test.exacttarget.com/Service.asmx?wsdl | https://auth-test.exacttargetapis.com/v1/requestToken?legacy=1 | + + +It is also possible to pass those values directly to the API object: +```python +params = { +    "clientid": "YOUR_CLIENT_ID", +    "clientsecret": "YOUR_CLIENT_SECRET" +} +api = ET_API(params=params) +``` + +## Examples + +### Get the List objects + +```python +# Add a require statement to reference the FuelSDK functionality +from FuelSDKWrapper import ET_API, ObjectType + +# Next, create an instance of the ET_API class +api = ET_API() + +# Get the List objects +response = api.get_objects(ObjectType.LIST) + +# Print out the results for viewing +print('Post Status: {}'.format(response.status)) +print('Code: {}'.format(response.code)) +print('Message: {}'.format(response.message)) +print('Result Count: {}'.format(len(response.results))) +print('Results: {}'.format(response.results)) +``` + +### Some examples of utilization + +```python +from FuelSDKWrapper import ET_API, ObjectType, Operator, FolderType, simple_filter, complex_filter +from datetime import datetime, timedelta + +api = ET_API() + +# Get Subscriber Data using the IN Operator +response = api.get_objects( +    ObjectType.SUBSCRIBER, +    simple_filter("EmailAddress", Operator.IN, ["my.email@domain.com", "your.email@domain.com"]) +) + +# Find Query Definition using the LIKE Operator +response = api.get_objects( +    ObjectType.QUERY_DEFINITION, +    simple_filter("QueryText", Operator.LIKE, "FROM My_DE"), +    property_list=["Name", "CategoryID", "QueryText"] +) + +# Get Jobs sent in the last 30 days +start_date = datetime.now() - timedelta(days=30) +response = api.get_objects( +    ObjectType.SEND, +    simple_filter("SendDate", Operator.GREATER_THAN, start_date) +) + +# Get Folder Data +response = api.get_objects( +    ObjectType.FOLDER, +    complex_filter( +        simple_filter("Name", Operator.EQUALS, "My_Folder_Name"), +        "OR", +        simple_filter("Name", Operator.EQUALS, "My_Other_Folder_Name") +    ), +    property_list=["ID", "Name"] +) + +# Get Folder Full Path +folder_id = 12345 +response = api.get_folder_full_path(folder_id) + +# Get or Create Folder Full Path +folder_names = ["Test", "Sub_Test"] +folder_type = FolderType.DATA_EXTENSIONS +response = api.get_or_create_folder_hierarchy(folder_type, folder_names) + +# Start an Automation +response = api.start_automation("Automation_Key") + +# Seng Trigger Email +response = api.send_trigger_email("MyTriggerKey", "email@email.com", "subscriberkey@email.com", attributes={ +    "first_nm": "Sebastien", +    "birth_dt": "1/1/1990" +}) + +# Get Tokens +short_token = api.get_client().authToken +long_token = api.get_client().internalAuthToken + +# Get Data Extension Fields sorted by Ordinal +fields = sorted(api.get_data_extension_columns("My_DE_Key").results, key=lambda x: x.Ordinal) + +# Clear Data Extension +response = api.clear_data_extension("DE_Key") + +# Create Batch of Data Extension Rows +# Synchronous +keys_list = [ +    ["Field1", "Field2", "Field3"],  # Fields for Row 1 +    ["Field1", "Field2", "Field3"],  # Fields for Row 2 +    ["Field1", "Field2", "Field3"]   # Fields for Row 3 +] +values_list = [ +    ["Row1_Value1", "Row1_Value2", "Row1_Value3"], +    ["Row2_Value1", "Row2_Value2", "Row2_Value3"], +    ["Row3_Value1", "Row3_Value2", "Row3_Value3"] +] +rows_inserted_count = api.create_data_extension_rows("DE_Key", keys_list, values_list) + +# Asynchronous Insert and Upsert +items_list = [ +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 1 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 2 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"}  # Row 3 +] +res = api.create_data_extension_rows_async("DE_Key", items_list) +res = api.upsert_data_extension_rows_async("DE_Key", items_list) + +# Retrieve Data Extension Rows via REST API for more advanced parameters +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=complex_filter( +        simple_filter("first_name", Operator.EQUALS, "John"), +        'AND', +        simple_filter("last_name", Operator.EQUALS, "Doe") +    ), +    property_list=["email_address", "first_name", "last_name"], +    order_by="first_name ASC,last_name DESC", +    page_size=100, +    page=5 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("full_name", Operator.LIKE, "Jo%Doe"), +    property_list=["email_address", "full_name"], +    max_rows=300 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("first_name", Operator.IN, ["Jane", "John"]), +    top=100 +) + +# Get Email Rendered Preview +res = api.get_objects( +    ObjectType.EMAIL,  +    simple_filter("Name", Operator.EQUALS, "BCLA_202001_06-LIVE"), +    property_list=["ID"] +) +email_id = res.results[0].ID +res = api.get_email_preview( +    email_id, +    data_extension_key="My_DE_Key", +    contact_key="My_Contact_Key" +) + +# Retrieve All Subscribers List ID +# The real ID is not what is sent by the SOAP List object +all_subscribers_list_id = api.get_all_subscribers_list_id() +``` + +### Get More Results + +```python +response = api.get_objects(ObjectType.LIST_SUBSCRIBER, +                           simple_filter("ListID", Operator.EQUALS, 1234), +                           property_list=["ID"]) +total = len(response.results) +while response.more_results: +    response = api.get_more_results() +    total += len(response.results) +``` + +### Extract Request + +```python +start_date = datetime.now() - timedelta(days=30) +end_date = datetime.now() +response = api.extract_data( +    parameters={"AccountIDs": "123456", "_AsyncID": 0, +        "StartDate": start_date, "EndDate": end_date, +        "ExtractSent": "true", "ExtractSendJobs": "true", "ExtractBounces": "false", "ExtractClicks": "false", +        "ExtractOpens": "false", "ExtractUnsubs": "false", "ExtractConversions": "false", +        "IncludeTestSends": "false", "IncludeUniqueClicks": "false", "IncludeUniqueOpens": "false", +        "ExtractSurveyResponses": "false", "Format": "tab", +        "OutputFileName": "extract.zip"}) +``` + +### Perform Request + +You can Perform the list of actions found [here](https://help.marketingcloud.com/en/technical_library/web_service_guide/methods/perform/). + +```python +response = api.get_objects( +    ObjectType.IMPORT_DEFINITION, +    simple_filter("Name", Operator.EQUALS, "Import_my_file") +) +try: +    import_def = response.results[0] +    response = api.perform_action("start", import_def) +except IndexError: +    print("No Import Definition found") +``` + +### List SOAP API Object Properties + +```python +response = api.get_info(ObjectType.CONTENT_AREA) +``` + +## Responses + +All methods on Fuel SDK objects return a generic object that follows the same structure, regardless of the type of call.  This object contains a common set of properties used to display details about the request. + +| Parameter | Description                                                     | +| --------- | --------------------------------------------------------------- | +| status    | Boolean value that indicates if the call was successful         | +| code      | HTTP Error Code (will always be 200 for SOAP requests)          | +| message   | Text values containing more details in the event of an Error    | +| results   | Collection containing the details unique to the method called.  | + +## Debug + +To debug any issues, activate the debug mode: +```python +api = ET_API(debug=True) +``` + +## Requirements + +Python 2.7.x +Python 3.x + +Libraries: + +* Salesforce-FuelSDK>=1.3.0 +* PyJWT>=0.1.9 +* requests>=2.18.4 +* suds-jurko>=0.6 + + + + +%package help +Summary:	Development documents and examples for FuelSDKWrapper +Provides:	python3-FuelSDKWrapper-doc +%description help +# FuelSDKWrapper +Simplify and enhance the FuelSDK for Salesforce Marketing Cloud (ExactTarget). + +## Overview +The Fuel SDK Wrapper for Python adds functionalities to the default Fuel SDK and provides access to more SOAP API objects. The Fuel SDK documentation can be found [here](https://github.com/salesforce-marketingcloud/FuelSDK-Python). + +## Installation +```python +pip install FuelSDKWrapper +``` + +## Getting Started + +### Configuring + +You must configure your access tokens and details for the Fuel SDK in one of the following two ways. + +1. Copy the included `config.python.template` file to `config.python` in either `~/.fuelsdk/`, within this python module or at the root of your project. +2. Add environment variables: +    * `FUELSDK_CLIENT_ID` (required) +    * `FUELSDK_CLIENT_SECRET` (required) +    * `FUELSDK_APP_SIGNATURE` +    * `FUELSDK_DEFAULT_WSDL` +    * `FUELSDK_AUTH_URL` +    * `FUELSDK_WSDL_FILE_LOCAL_LOC` + +Edit `config.python` or declare environment variables so you can input the ClientID and Client Secret values provided when you registered your application. If you are building a HubExchange application for the Interactive Marketing Hub then, you must also provide the Application Signature (`appsignature` / `FUELSDK_APP_SIGNATURE`). +The `defaultwsdl` / `FUELSDK_DEFAULT_WSDL` configuration must be [changed depending on the ExactTarget service](https://code.exacttarget.com/question/there-any-cetificrate-install-our-server-access-et-api "ExactTarget Forum"). +The `authenticationurl` / `FUELSDK_AUTH_URL` must also be [changed depending on service](https://code.exacttarget.com/question/not-able-create-accesstoken-when-clientidsecret-associated-preproduction-account "ExactTarget Forum"). +The `wsdl_file_local_loc` / `FUELSDK_WSDL_FILE_LOCAL_LOC` allows you to specify the full path/filename where the WSDL file will be located on disk, if for instance you are connecting to different endpoints from the same server. + +If you have not registered your application or you need to lookup your Application Key or Application Signature values, please go to App Center at [Code@: ExactTarget's Developer Community](http://code.exacttarget.com/appcenter "Code@ App Center"). + + +| Environment | WSDL (default) | URL (auth) | +| ----------- | -------------- | ---------- | +| Production  | https://webservice.exacttarget.com/etframework.wsdl | https://auth.exacttargetapis.com/v1/requestToken?legacy=1 | +| Sandbox     | https://webservice.test.exacttarget.com/Service.asmx?wsdl | https://auth-test.exacttargetapis.com/v1/requestToken?legacy=1 | + + +It is also possible to pass those values directly to the API object: +```python +params = { +    "clientid": "YOUR_CLIENT_ID", +    "clientsecret": "YOUR_CLIENT_SECRET" +} +api = ET_API(params=params) +``` + +## Examples + +### Get the List objects + +```python +# Add a require statement to reference the FuelSDK functionality +from FuelSDKWrapper import ET_API, ObjectType + +# Next, create an instance of the ET_API class +api = ET_API() + +# Get the List objects +response = api.get_objects(ObjectType.LIST) + +# Print out the results for viewing +print('Post Status: {}'.format(response.status)) +print('Code: {}'.format(response.code)) +print('Message: {}'.format(response.message)) +print('Result Count: {}'.format(len(response.results))) +print('Results: {}'.format(response.results)) +``` + +### Some examples of utilization + +```python +from FuelSDKWrapper import ET_API, ObjectType, Operator, FolderType, simple_filter, complex_filter +from datetime import datetime, timedelta + +api = ET_API() + +# Get Subscriber Data using the IN Operator +response = api.get_objects( +    ObjectType.SUBSCRIBER, +    simple_filter("EmailAddress", Operator.IN, ["my.email@domain.com", "your.email@domain.com"]) +) + +# Find Query Definition using the LIKE Operator +response = api.get_objects( +    ObjectType.QUERY_DEFINITION, +    simple_filter("QueryText", Operator.LIKE, "FROM My_DE"), +    property_list=["Name", "CategoryID", "QueryText"] +) + +# Get Jobs sent in the last 30 days +start_date = datetime.now() - timedelta(days=30) +response = api.get_objects( +    ObjectType.SEND, +    simple_filter("SendDate", Operator.GREATER_THAN, start_date) +) + +# Get Folder Data +response = api.get_objects( +    ObjectType.FOLDER, +    complex_filter( +        simple_filter("Name", Operator.EQUALS, "My_Folder_Name"), +        "OR", +        simple_filter("Name", Operator.EQUALS, "My_Other_Folder_Name") +    ), +    property_list=["ID", "Name"] +) + +# Get Folder Full Path +folder_id = 12345 +response = api.get_folder_full_path(folder_id) + +# Get or Create Folder Full Path +folder_names = ["Test", "Sub_Test"] +folder_type = FolderType.DATA_EXTENSIONS +response = api.get_or_create_folder_hierarchy(folder_type, folder_names) + +# Start an Automation +response = api.start_automation("Automation_Key") + +# Seng Trigger Email +response = api.send_trigger_email("MyTriggerKey", "email@email.com", "subscriberkey@email.com", attributes={ +    "first_nm": "Sebastien", +    "birth_dt": "1/1/1990" +}) + +# Get Tokens +short_token = api.get_client().authToken +long_token = api.get_client().internalAuthToken + +# Get Data Extension Fields sorted by Ordinal +fields = sorted(api.get_data_extension_columns("My_DE_Key").results, key=lambda x: x.Ordinal) + +# Clear Data Extension +response = api.clear_data_extension("DE_Key") + +# Create Batch of Data Extension Rows +# Synchronous +keys_list = [ +    ["Field1", "Field2", "Field3"],  # Fields for Row 1 +    ["Field1", "Field2", "Field3"],  # Fields for Row 2 +    ["Field1", "Field2", "Field3"]   # Fields for Row 3 +] +values_list = [ +    ["Row1_Value1", "Row1_Value2", "Row1_Value3"], +    ["Row2_Value1", "Row2_Value2", "Row2_Value3"], +    ["Row3_Value1", "Row3_Value2", "Row3_Value3"] +] +rows_inserted_count = api.create_data_extension_rows("DE_Key", keys_list, values_list) + +# Asynchronous Insert and Upsert +items_list = [ +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 1 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"},  # Row 2 +    {"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"}  # Row 3 +] +res = api.create_data_extension_rows_async("DE_Key", items_list) +res = api.upsert_data_extension_rows_async("DE_Key", items_list) + +# Retrieve Data Extension Rows via REST API for more advanced parameters +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=complex_filter( +        simple_filter("first_name", Operator.EQUALS, "John"), +        'AND', +        simple_filter("last_name", Operator.EQUALS, "Doe") +    ), +    property_list=["email_address", "first_name", "last_name"], +    order_by="first_name ASC,last_name DESC", +    page_size=100, +    page=5 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("full_name", Operator.LIKE, "Jo%Doe"), +    property_list=["email_address", "full_name"], +    max_rows=300 +) + +items, items_count = api.get_data_extension_rows_rest( +    customer_key="DE_CUSTOMER_KEY", +    search_filter=simple_filter("first_name", Operator.IN, ["Jane", "John"]), +    top=100 +) + +# Get Email Rendered Preview +res = api.get_objects( +    ObjectType.EMAIL,  +    simple_filter("Name", Operator.EQUALS, "BCLA_202001_06-LIVE"), +    property_list=["ID"] +) +email_id = res.results[0].ID +res = api.get_email_preview( +    email_id, +    data_extension_key="My_DE_Key", +    contact_key="My_Contact_Key" +) + +# Retrieve All Subscribers List ID +# The real ID is not what is sent by the SOAP List object +all_subscribers_list_id = api.get_all_subscribers_list_id() +``` + +### Get More Results + +```python +response = api.get_objects(ObjectType.LIST_SUBSCRIBER, +                           simple_filter("ListID", Operator.EQUALS, 1234), +                           property_list=["ID"]) +total = len(response.results) +while response.more_results: +    response = api.get_more_results() +    total += len(response.results) +``` + +### Extract Request + +```python +start_date = datetime.now() - timedelta(days=30) +end_date = datetime.now() +response = api.extract_data( +    parameters={"AccountIDs": "123456", "_AsyncID": 0, +        "StartDate": start_date, "EndDate": end_date, +        "ExtractSent": "true", "ExtractSendJobs": "true", "ExtractBounces": "false", "ExtractClicks": "false", +        "ExtractOpens": "false", "ExtractUnsubs": "false", "ExtractConversions": "false", +        "IncludeTestSends": "false", "IncludeUniqueClicks": "false", "IncludeUniqueOpens": "false", +        "ExtractSurveyResponses": "false", "Format": "tab", +        "OutputFileName": "extract.zip"}) +``` + +### Perform Request + +You can Perform the list of actions found [here](https://help.marketingcloud.com/en/technical_library/web_service_guide/methods/perform/). + +```python +response = api.get_objects( +    ObjectType.IMPORT_DEFINITION, +    simple_filter("Name", Operator.EQUALS, "Import_my_file") +) +try: +    import_def = response.results[0] +    response = api.perform_action("start", import_def) +except IndexError: +    print("No Import Definition found") +``` + +### List SOAP API Object Properties + +```python +response = api.get_info(ObjectType.CONTENT_AREA) +``` + +## Responses + +All methods on Fuel SDK objects return a generic object that follows the same structure, regardless of the type of call.  This object contains a common set of properties used to display details about the request. + +| Parameter | Description                                                     | +| --------- | --------------------------------------------------------------- | +| status    | Boolean value that indicates if the call was successful         | +| code      | HTTP Error Code (will always be 200 for SOAP requests)          | +| message   | Text values containing more details in the event of an Error    | +| results   | Collection containing the details unique to the method called.  | + +## Debug + +To debug any issues, activate the debug mode: +```python +api = ET_API(debug=True) +``` + +## Requirements + +Python 2.7.x +Python 3.x + +Libraries: + +* Salesforce-FuelSDK>=1.3.0 +* PyJWT>=0.1.9 +* requests>=2.18.4 +* suds-jurko>=0.6 + + + + +%prep +%autosetup -n FuelSDKWrapper-1.3.4 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then +	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then +	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then +	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then +	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then +	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-FuelSDKWrapper -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.4-1 +- Package Spec generated @@ -0,0 +1 @@ +690cf4766b6972cd6183664aeb1f5a05  FuelSDKWrapper-1.3.4.tar.gz | 
