8000 Merge pull request #12 from duboisnicolas/update-readme · yurib/FuelSDK-Python@181cf72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 181cf72

Browse files
committed
Merge pull request salesforce-marketingcloud#12 from duboisnicolas/update-readme
Refactored README file
2 parents 803de39 + 81be156 commit 181cf72

File tree

1 file changed

+104
-98
lines changed

1 file changed

+104
-98
lines changed

README.md

Lines changed: 104 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,80 @@
1-
FuelSDK-Python
2-
============
1+
# FuelSDK-Python
32

43
ExactTarget Fuel SDK for Python
54

6-
## Overview ##
7-
The Fuel SDK for Python provides easy access to ExactTarget's Fuel API Family services, including a collection of REST APIs and a SOAP API. These APIs provide access to ExactTarget functionality via common collection types such as array/hash.
5+
## Overview
6+
7+
The Fuel SDK for Python provides easy access to ExactTarget's Fuel API Family services, including a collection of REST APIs and a SOAP API. These APIs provide access to ExactTarget functionality via common collection types such as array/hash.
8+
9+
## Requirements
810

9-
## Requirements ##
1011
Python 2.7.3
1112

12-
libraries:
13+
Libraries:
1314

14-
- pyjwt 0.1.5
15-
- requests 1.1.0
16-
- suds 0.4
15+
* pyjwt 0.1.5
16+
* requests 1.1.0
17+
* suds 0.4
1718

1819
The quickest way to install the required libraries is to use pip and tell it to load the libraries listed in the requiredlibraries.txt file (see below). Pip is a tool for installing and managing Python packages and is available at https://pypi.python.org/pypi/pip.
1920

21+
```
2022
pip install -r requirements.txt
23+
```
2124

25+
## Getting Started
2226

23-
## Getting Started ##
27+
### Configuring
2428

25-
### Configuring ###
26-
After downloading the project, rename the config.python.template file to config.python.
29+
After downloading the project, rename the `config.python.template` file to `config.python`.
2730

28-
Edit config.python 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). The defaultwsdl 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").
31+
Edit `config.python` 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).
32+
The defaultwsdl 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").
2933
The authenticationurl must also be [changed depending on service](https://code.exacttarget.com/question/not-able-create-accesstoken-when-clientidsecret-associated-preproduction-account "ExactTarget Forum").
3034

3135
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").
3236

33-
For S1 Production:
3437

35-
defaultwsdl: https://webservice.exacttarget.com/etframework.wsdl
36-
authenticationurl: https://auth.exacttargetapis.com/v1/requestToken?legacy=1
38+
| Environment | WSDL (default) | URL (auth) |
39+
| ----------- | -------------- | ---------- |
40+
| Production | https://webservice.exacttarget.com/etframework.wsdl | https://auth.exacttargetapis.com/v1/requestToken?legacy=1 |
41+
| Sandbox | https://webservice.test.exacttarget.com/Service.asmx?wsdl | https://auth-test.exacttargetapis.com/v1/requestToken?legacy=1 |
42+
3743

38-
For Sandbox:
44+
## Example Request
3945

40-
defaultwsdl: https://webservice.test.exacttarget.com/Service.asmx?wsdl,
41-
authenticationurl:"https://auth-test.exacttargetapis.com/v1/requestToken?legacy=1
46+
### Code
4247

43-
## Example Request ##
4448
All ExactTarget objects exposed through the Fuel SDK begin with be prefixed with "ET\_". Start by working with the ET_List object:
4549

46-
Add a require statement to reference the Fuel SDK's functionality:
47-
> import FuelSDK
50+
```python
51+
# Add a require statement to reference the Fuel SDK's functionality:
52+
import FuelSDK
4853

49-
Next, create an instance of the ET_Client class:
50-
> myClient = FuelSDK.ET_Client()
54+
# Next, create an instance of the ET_Client class:
55+
myClient = FuelSDK.ET_Client()
5156

52-
Create an instance of the object type we want to work with:
53-
> list = FuelSDK.ET_List()
57+
# Create an instance of the object type we want to work with:
58+
list = FuelSDK.ET_List()
5459

55-
Associate the ET_Client to the object using the auth_stub property:
56-
> list.auth_stub = myClient
60+
# Associate the ET_Client to the object using the auth_stub property:
61+
list.auth_stub = myClient
5762

58-
Utilize one of the ET_List methods:
59-
> response = list.get()
63+
# Utilize one of the ET_List methods:
64+
response = list.get()
6065

61-
Print out the results for viewing
62-
> print 'Post Status: ' + str(response.status) <br />
66+
# Print out the results for viewing
67+
print 'Post Status: ' + str(response.status) <br />
6368
print 'Code: ' + str(response.code) <br />
6469
print 'Message: ' + str(response.message) <br />
6570
print 'Result Count: ' + str(len(response.results)) <br />
6671
print 'Results: ' + str(response.results)
72+
```
6773

6874

69-
**Example Output:**
75+
### Example Output
7076

71-
<pre>
77+
```
7278
Retrieve Status: True
7379
Code: 200
7480
Message: OK
@@ -91,97 +97,97 @@ Results: [(List){
9197
Description = "This list was created with the PythonSDK"
9298
ListClassification = "ExactTargetList"
9399
}]
94-
</pre>
100+
```
95101

96-
## ET\_Client Class ##
102+
## ET\_Client Class
97103

98-
The ET\_Client class takes care of many of the required steps when accessing ExactTarget's API, including retrieving appropriate access tokens, handling token state for managing refresh, and determining the appropriate endpoints for API requests. In order to leverage the advantages this class provides, use a single instance of this class for an entire session. Do not instantiate a new ET_Client object for each request made.
104+
The ET\_Client class takes care of many of the required steps when accessing ExactTarget's API, including retrieving appropriate access tokens, handling token state for managing refresh, and determining the appropriate endpoints for API requests. In order to leverage the advantages this class provides, use a single instance of this class for an entire session. Do not instantiate a new ET_Client object for each request made.
105+
106+
## Responses
99107

100-
## Responses ##
101108
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.
102109

103-
- status: Boolean value that indicates if the call was successful
104-
- code: HTTP Error Code (will always be 200 for SOAP requests)
105-
- message: Text values containing more details in the event of an error
106-
- results: Collection containing the details unique to the method called.
110+
| Parameter | Description |
111+
| --------- | --------------------------------------------------------------- |
112+
| status | Boolean value that indicates if the call was successful |
113+
| code | HTTP Error Code (will always be 200 for SOAP requests) |
114+
| message | Text values containing more details in the event of an Error |
115+
| results | Collection containing the details unique to the method called. |
107116

108117
Get Methods also return an addition value to indicate if more information is available (that information can be retrieved using the getMoreResults method):
109118

110-
- moreResults - Boolean value that indicates on Get requests if more data is available.
119+
- moreResults - Boolean value that indicates on Get requests if more data is available.
120+
111121

122+
## Samples
112123

113-
## Samples ##
114-
Find more sample files that illustrate using all of the available functions for ExactTarget objects exposed through the API in the objsamples directory.
124+
Find more sample files that illustrate using all of the available functions for ExactTarget objects exposed through the API in the objsamples directory.
115125

116126
Sample List:
117127

118-
- [BounceEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_bounceevent.py)
119-
- [Campaign](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_campaign.py)
120-
- [ClickEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_clickevent.py)
121-
- [ContentArea](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_contentarea.py)
122-
- [DataExtension](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_dataextension.py)
123-
- [Email](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_email.py)
124-
- [List](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_list.py)
125-
- [List > Subscriber](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_subscriber.py)
126-
- [OpenEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_openevent.py)
127-
- [SentEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_sentevent.py)
128-
- [Subscriber](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_subscriber.py)
129-
- [TriggeredSend](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_triggeredsend.py)
130-
- [UnsubEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_unsubevent.py)
131-
132-
### Custom Suds Changes (Deprecated) ###
128+
* [BounceEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_bounceevent.py)
129+
* [Campaign](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_campaign.py)
130+
* [ClickEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_clickevent.py)
131+
* [ContentArea](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_contentarea.py)
132+
* [DataExtension](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_dataextension.py)
133+
* [Email](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_email.py)
134+
* [List](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_list.py)
135+
* [List > Subscriber](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_subscriber.py)
136+
* [OpenEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_openevent.py)
137+
* [SentEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_sentevent.py)
138+
* [Subscriber](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_subscriber.py)
139+
* [TriggeredSend](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_triggeredsend.py)
140+
* [UnsubEvent](https://github.com/ExactTarget/FuelSDK-Python/blob/master/objsamples/sample_unsubevent.py)
141+
142+
### Custom Suds Changes (Deprecated)
133143

134144
**Note**: Suds is now patched at runtime when importing the FuelSDK. You no longer need to edit the library. Please be aware of the change.
135145

136146
The default Suds 0.4 Package that is available for download needs to have a couple small fixes applied in order for it to fully support the Fuel SDK. Please update your suds installation using the following instructions:
137147

138148
- Download the suds package source from https://pypi.python.org/pypi/suds
139-
- Open the file located wihin the uncompressed files at: suds\mx\appender.py
149+
- Open the file located wihin the uncompressed files at: `suds\mx\appender.py`
140150
- At line 223, the following lines will be present:
141-
><pre>
142-
child.setText(p.get())
143-
parent.append(child)
144-
for item in p.items():
145-
cont = Content(tag=item[0], value=item[1])
146-
Appender.append(self, child, cont)
147-
</pre>
151+
```python
152+
child.setText(p.get())
153+
parent.append(child)
154+
for item in p.items():
155+
cont = Content(tag=item[0], value=item[1])
156+
Appender.append(self, child, cont)
157+
```
148158

149159
- Replace those lines with:
150-
><pre>
151-
child_value = p.get()
152-
if(child_value is None):
153-
pass
154-
else:
155-
child.setText(child_value)
156-
parent.append(child)
157-
for item in p.items():
158-
cont = Content(tag=item[0], value=item[1])
159-
Appender.append(self, child, cont)
160-
161-
</pre>
162-
163-
- Open the file located wihin the uncompressed files at suds\bindings\document.py
160+
```python
161+
child_value = p.get()
162+
if(child_value is None):
163+
pass
164+
else:
165+
child.setText(child_value)
166+
parent.append(child)
167+
for item in p.items():
168+
cont = Content(tag=item[0], value=item[1])
169+
Appender.append(self, child, cont)
170+
```
171+
172+
- Open the file located wihin the uncompressed files at `suds\bindings\document.py`
164173
- After line 62 which reads:
165-
><pre>
166-
n += 1
167-
</pre>
168-
169-
- Add the following lines:
170-
><pre>
171-
if value is None:
172-
continue
173-
</pre>
174+
```python
175+
n += 1
176+
```
177+
178+
- Add the following lines:
179+
```python
180+
if value is None:
181+
continue
182+
```
174183
- Install Suds by running the command
175-
> python setup.py install
184+
```
185+
python setup.py install
186+
``
176187
177-
## Copyright and license ##
188+
## Copyright and license
178189
Copyright (c) 2013 ExactTarget
179190
180191
Licensed under the MIT License (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the COPYING file.
181192
182193
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
183-
184-
185-
186-
187-

0 commit comments

Comments
 (0)
0