Skip to content

Commit eef7409

Browse files
committed
added user-agent to track calls made from this SDK
1 parent 5b878b6 commit eef7409

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

FuelSDK/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def refresh_token(self, force_refresh = False):
177177
"""
178178
#If we don't already have a token or the token expires within 5 min(300 seconds), get one
179179
if (force_refresh or self.authToken is None or (self.authTokenExpiration is not None and time.time() + 300 > self.authTokenExpiration)):
180-
headers = {'content-type' : 'application/json'}
180+
headers = {'content-type' : 'application/json', 'user-agent' : 'FuelSDK-Python'}
181181
if (self.authToken is None):
182182
payload = {'clientId' : self.client_id, 'clientSecret' : self.client_secret, 'accessType': 'offline'}
183183
else:
@@ -205,7 +205,7 @@ def determineStack(self):
205205
find the correct url that data request web calls should go against for the token we have.
206206
"""
207207
try:
208-
r = requests.get('https://www.exacttargetapis.com/platform/v1/endpoints/soap?access_token=' + self.authToken)
208+
r = requests.get('https://www.exacttargetapis.com/platform/v1/endpoints/soap?access_token=' + self.authToken, {'user-agent' : 'FuelSDK-Python'})
209209
contextResponse = r.json()
210210
if('url' in contextResponse):
211211
return str(contextResponse['url'])

FuelSDK/rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class ET_PostRest(ET_Constructor):
349349
def __init__(self, auth_stub, endpoint, payload):
350350
auth_stub.refresh_token()
351351

352-
headers = {'content-type' : 'application/json'}
352+
headers = {'content-type' : 'application/json', 'user-agent' : 'FuelSDK-Python'}
353353
r = requests.post(endpoint + '?access_token=' + auth_stub.authToken , data=json.dumps(payload), headers=headers)
354354

355355
obj = super(ET_PostRest, self).__init__(r, True)
@@ -364,7 +364,7 @@ class ET_PatchRest(ET_Constructor):
364364
def __init__(self, auth_stub, endpoint, payload):
365365
auth_stub.refresh_token()
366366

367-
headers = {'content-type' : 'application/json'}
367+
headers = {'content-type' : 'application/json', 'user-agent' : 'FuelSDK-Python'}
368368
r = requests.patch(endpoint + '?access_token=' + auth_stub.authToken , data=json.dumps(payload), headers=headers)
369369

370370
obj = super(ET_PatchRest, self).__init__(r, True)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy