@@ -180,8 +180,7 @@ def track(
180180 params ['force_workflow_run' ] = 'true'
181181
182182 if include_score_percentiles :
183- field_types = ['SCORE_PERCENTILES' ]
184- params ['fields' ] = ',' .join (field_types )
183+ params ['fields' ] = 'SCORE_PERCENTILES'
185184 try :
186185 response = self .session .post (
187186 path ,
@@ -193,7 +192,7 @@ def track(
193192 except requests .exceptions .RequestException as e :
194193 raise ApiException (str (e ), path )
195194
196- def score (self , user_id , timeout = None , abuse_types = None , version = None ):
195+ def score (self , user_id , timeout = None , abuse_types = None , version = None , include_score_percentiles = False ):
197196 """Retrieves a user's fraud score from the Sift Science API.
198197 This call is blocking. Check out https://siftscience.com/resources/references/score_api.html
199198 for more information on our Score response structure.
@@ -210,6 +209,9 @@ def score(self, user_id, timeout=None, abuse_types=None, version=None):
210209
211210 version(optional): Use a different version of the Sift Science API for this call.
212211
212+ include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
213+ if include_score_percentiles is true then add a new parameter called fields in the query parameter
214+
213215 Returns:
214216 A sift.client.Response object if the score call succeeded, or raises
215217 an ApiException.
@@ -227,6 +229,9 @@ def score(self, user_id, timeout=None, abuse_types=None, version=None):
227229 if abuse_types :
228230 params ['abuse_types' ] = ',' .join (abuse_types )
229231
232+ if include_score_percentiles :
233+ params ['fields' ] = 'SCORE_PERCENTILES'
234+
230235 url = self ._score_url (user_id , version )
231236
232237 try :
@@ -239,7 +244,7 @@ def score(self, user_id, timeout=None, abuse_types=None, version=None):
239244 except requests .exceptions .RequestException as e :
240245 raise ApiException (str (e ), url )
241246
242- def get_user_score (self , user_id , timeout = None , abuse_types = None ):
247+ def get_user_score (self , user_id , timeout = None , abuse_types = None , include_score_percentiles = False ):
243248 """Fetches the latest score(s) computed for the specified user and abuse types from the Sift Science API.
244249 As opposed to client.score() and client.rescore_user(), this *does not* compute a new score for the user; it
245250 simply fetches the latest score(s) which have computed. These scores may be arbitrarily old.
@@ -256,6 +261,9 @@ def get_user_score(self, user_id, timeout=None, abuse_types=None):
256261 should be returned (if scores were requested). If not specified, a score will
257262 be returned for every abuse_type to which you are subscribed.
258263
264+ include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
265+ if include_score_percentiles is true then add a new parameter called fields in the query parameter
266+
259267 Returns:
260268 A sift.client.Response object if the score call succeeded, or raises
261269 an ApiException.
@@ -271,6 +279,9 @@ def get_user_score(self, user_id, timeout=None, abuse_types=None):
271279 if abuse_types :
272280 params ['abuse_types' ] = ',' .join (abuse_types )
273281
282+ if include_score_percentiles :
283+ params ['fields' ] = 'SCORE_PERCENTILES'
284+
274285 try :
275286 response = self .session .get (
276287 url ,
0 commit comments