telesign 2.2.5__tar.gz → 3.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {telesign-2.2.5/telesign.egg-info → telesign-3.0.1}/PKG-INFO +7 -1
  2. {telesign-2.2.5 → telesign-3.0.1}/setup.py +8 -5
  3. {telesign-2.2.5 → telesign-3.0.1}/telesign/__init__.py +0 -2
  4. {telesign-2.2.5 → telesign-3.0.1}/telesign/rest.py +66 -18
  5. {telesign-2.2.5 → telesign-3.0.1/telesign.egg-info}/PKG-INFO +7 -1
  6. {telesign-2.2.5 → telesign-3.0.1}/telesign.egg-info/SOURCES.txt +0 -4
  7. {telesign-2.2.5 → telesign-3.0.1}/tests/test_phoneid.py +0 -19
  8. {telesign-2.2.5 → telesign-3.0.1}/tests/test_rest.py +34 -1
  9. telesign-2.2.5/examples/appverify/1_get_status_by_external_id.py +0 -16
  10. telesign-2.2.5/examples/intelligence/1_get_risk_score_and_related_insights.py +0 -29
  11. telesign-2.2.5/telesign/appverify.py +0 -28
  12. telesign-2.2.5/telesign/intelligence.py +0 -39
  13. {telesign-2.2.5 → telesign-3.0.1}/LICENSE.txt +0 -0
  14. {telesign-2.2.5 → telesign-3.0.1}/MANIFEST.in +0 -0
  15. {telesign-2.2.5 → telesign-3.0.1}/README.rst +0 -0
  16. {telesign-2.2.5 → telesign-3.0.1}/examples/messaging/1_send_message.py +0 -0
  17. {telesign-2.2.5 → telesign-3.0.1}/examples/messaging/2_send_message_with_verification_code.py +0 -0
  18. {telesign-2.2.5 → telesign-3.0.1}/examples/phoneid/1_check_phone_type_to_block_voip.py +0 -0
  19. {telesign-2.2.5 → telesign-3.0.1}/examples/phoneid/2_cleansing.py +0 -0
  20. {telesign-2.2.5 → telesign-3.0.1}/examples/score/1_check_phone_number_risk_level.py +0 -0
  21. {telesign-2.2.5 → telesign-3.0.1}/examples/voice/1_send_voice_call.py +0 -0
  22. {telesign-2.2.5 → telesign-3.0.1}/examples/voice/2_send_voice_call_with_verification_code.py +0 -0
  23. {telesign-2.2.5 → telesign-3.0.1}/examples/voice/3_send_voice_call_french.py +0 -0
  24. {telesign-2.2.5 → telesign-3.0.1}/setup.cfg +0 -0
  25. {telesign-2.2.5 → telesign-3.0.1}/telesign/messaging.py +0 -0
  26. {telesign-2.2.5 → telesign-3.0.1}/telesign/phoneid.py +0 -0
  27. {telesign-2.2.5 → telesign-3.0.1}/telesign/score.py +0 -0
  28. {telesign-2.2.5 → telesign-3.0.1}/telesign/util.py +0 -0
  29. {telesign-2.2.5 → telesign-3.0.1}/telesign/voice.py +0 -0
  30. {telesign-2.2.5 → telesign-3.0.1}/telesign.egg-info/dependency_links.txt +0 -0
  31. {telesign-2.2.5 → telesign-3.0.1}/telesign.egg-info/requires.txt +0 -0
  32. {telesign-2.2.5 → telesign-3.0.1}/telesign.egg-info/top_level.txt +0 -0
  33. {telesign-2.2.5 → telesign-3.0.1}/tests/__init__.py +0 -0
  34. {telesign-2.2.5 → telesign-3.0.1}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: telesign
3
- Version: 2.2.5
3
+ Version: 3.0.1
4
4
  Summary: TeleSign SDK
5
5
  Home-page: https://github.com/telesign/python_telesign
6
6
  Author: TeleSign Corp.
@@ -112,3 +112,9 @@ Classifier: Programming Language :: Python :: 3.3
112
112
  Classifier: Programming Language :: Python :: 3.4
113
113
  Classifier: Programming Language :: Python :: 3.5
114
114
  Classifier: Programming Language :: Python :: 3.6
115
+ Classifier: Programming Language :: Python :: 3.7
116
+ Classifier: Programming Language :: Python :: 3.8
117
+ Classifier: Programming Language :: Python :: 3.9
118
+ Classifier: Programming Language :: Python :: 3.10
119
+ Classifier: Programming Language :: Python :: 3.11
120
+ Classifier: Programming Language :: Python :: 3.12
@@ -6,12 +6,9 @@ from setuptools import setup, find_packages
6
6
 
7
7
  EXCLUDE_FROM_PACKAGES = ['tests']
8
8
 
9
- needs_mock = sys.version_info < (3, 3)
10
- mock = ['mock'] if needs_mock else []
11
-
12
9
  here = path.abspath(path.dirname(__file__))
13
10
 
14
- version = "2.2.5"
11
+ version = "3.0.1"
15
12
 
16
13
  with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
17
14
  long_description = f.read()
@@ -34,6 +31,12 @@ setup(name='telesign',
34
31
  "Programming Language :: Python :: 3.4",
35
32
  "Programming Language :: Python :: 3.5",
36
33
  "Programming Language :: Python :: 3.6",
34
+ "Programming Language :: Python :: 3.7",
35
+ "Programming Language :: Python :: 3.8",
36
+ "Programming Language :: Python :: 3.9",
37
+ "Programming Language :: Python :: 3.10",
38
+ "Programming Language :: Python :: 3.11",
39
+ "Programming Language :: Python :: 3.12",
37
40
  ],
38
41
  long_description=long_description,
39
42
  keywords='telesign, sms, voice, mobile, authentication, identity, messaging',
@@ -42,6 +45,6 @@ setup(name='telesign',
42
45
  url="https://github.com/telesign/python_telesign",
43
46
  install_requires=['requests'],
44
47
  test_suite='nose.collector',
45
- tests_require=['nose', 'pytz'] + mock,
48
+ tests_require=['nose', 'pytz'],
46
49
  packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
47
50
  )
@@ -1,7 +1,5 @@
1
1
  from pkg_resources import get_distribution
2
2
 
3
- __import__('pkg_resources').declare_namespace(__name__)
4
-
5
3
  __version__ = get_distribution("telesign").version
6
4
  __author__ = "TeleSign"
7
5
  __copyright__ = "Copyright 2017, TeleSign Corp."
@@ -6,6 +6,7 @@ from base64 import b64encode, b64decode
6
6
  from email.utils import formatdate
7
7
  from hashlib import sha256
8
8
  from platform import python_version
9
+ import time
9
10
 
10
11
  import requests
11
12
  import json
@@ -16,18 +17,14 @@ from telesign.util import AuthMethod
16
17
 
17
18
  class RestClient(requests.models.RequestEncodingMixin):
18
19
  """
19
- The TeleSign RestClient is a generic HTTP REST client that can be extended to make requests against any of
20
- TeleSign's REST API endpoints.
20
+ The Telesign RestClient is a generic HTTP REST client that can be extended to make requests against any of
21
+ Telesign's REST API endpoints.
21
22
 
22
23
  RequestEncodingMixin offers the function _encode_params for url encoding the body for use in string_to_sign outside
23
24
  of a regular HTTP request.
24
25
 
25
26
  See https://developer.telesign.com for detailed API documentation.
26
27
  """
27
- user_agent = "TeleSignSDK/python-{sdk_version} Python/{python_version} Requests/{requests_version}".format(
28
- sdk_version=telesign.__version__,
29
- python_version=python_version(),
30
- requests_version=requests.__version__)
31
28
 
32
29
  class Response(object):
33
30
  """
@@ -51,11 +48,15 @@ class RestClient(requests.models.RequestEncodingMixin):
51
48
  customer_id,
52
49
  api_key,
53
50
  rest_endpoint='https://rest-api.telesign.com',
51
+ source="python_telesign",
52
+ sdk_version_origin=None,
53
+ sdk_version_dependency=None,
54
54
  proxies=None,
55
55
  timeout=10,
56
- auth_method=None):
56
+ auth_method=None,
57
+ pool_recycle=480):
57
58
  """
58
- TeleSign RestClient useful for making generic RESTful requests against our API.
59
+ Telesign RestClient useful for making generic RESTful requests against our API.
59
60
 
60
61
  :param customer_id: Your customer_id string associated with your account.
61
62
  :param api_key: Your api_key string associated with your account.
@@ -63,13 +64,22 @@ class RestClient(requests.models.RequestEncodingMixin):
63
64
  :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy.
64
65
  :param timeout: (optional) How long to wait for the server to send data before giving up, as a float,
65
66
  or as a (connect timeout, read timeout) tuple
67
+ :param pool_recycle: (optional) Time in seconds to recycle the HTTP session to avoid stale connections (default 480).
68
+ If a session is older than this value, it will be closed and a new session will be created automatically before each request.
69
+ This helps prevent errors due to HTTP keep-alive connections being closed by the server after inactivity.
70
+
71
+ HTTP Keep-Alive behavior:
72
+ TeleSign endpoints close idle HTTP keep-alive connections after 499 seconds. If you attempt to reuse a connection older than this, you may get a 'connection reset by peer' error.
73
+ By default, pool_recycle=480 ensures sessions are refreshed before this limit.
66
74
  """
67
75
  self.customer_id = customer_id
68
76
  self.api_key = api_key
69
77
 
70
78
  self.api_host = rest_endpoint
71
79
 
72
- self.session = requests.Session()
80
+ self.pool_recycle = pool_recycle
81
+ self._session_created_at = None
82
+ self.session = self._create_session()
73
83
 
74
84
  self.session.proxies = proxies if proxies else {}
75
85
 
@@ -77,6 +87,17 @@ class RestClient(requests.models.RequestEncodingMixin):
77
87
 
78
88
  self.auth_method = auth_method
79
89
 
90
+ current_version_sdk = telesign.__version__ if source == "python_telesign" else sdk_version_origin
91
+
92
+ self.user_agent = "TeleSignSDK/python Python/{python_version} Requests/{requests_version} OriginatingSDK/{source} SDKVersion/{sdk_version}".format(
93
+ python_version=python_version(),
94
+ requests_version=requests.__version__,
95
+ source=source,
96
+ sdk_version=current_version_sdk)
97
+
98
+ if source != "python_telesign":
99
+ self.user_agent = self.user_agent + " DependencySDKVersion/{sdk_version_dependency}".format(sdk_version_dependency=sdk_version_dependency)
100
+
80
101
  @staticmethod
81
102
  def generate_telesign_headers(customer_id,
82
103
  api_key,
@@ -89,17 +110,17 @@ class RestClient(requests.models.RequestEncodingMixin):
89
110
  content_type=None,
90
111
  auth_method=None):
91
112
  """
92
- Generates the TeleSign REST API headers used to authenticate requests.
113
+ Generates the Telesign REST API headers used to authenticate requests.
93
114
 
94
115
  Creates the canonicalized string_to_sign and generates the HMAC signature. This is used to authenticate requests
95
- against the TeleSign REST API.
116
+ against the Telesign REST API.
96
117
 
97
118
  See https://developer.telesign.com/docs/authentication for detailed API documentation.
98
119
 
99
120
  :param customer_id: Your account customer_id.
100
121
  :param api_key: Your account api_key.
101
122
  :param method_name: The HTTP method name of the request as a upper case string, should be one of 'POST', 'GET',
102
- 'PUT' or 'DELETE'.
123
+ 'PUT', 'PATCH' or 'DELETE'.
103
124
  :param resource: The partial resource URI to perform the request against, as a string.
104
125
  :param url_encoded_fields: HTTP body parameters to perform the HTTP request with, must be a urlencoded string.
105
126
  :param date_rfc2616: The date and time of the request formatted in rfc 2616, as a string.
@@ -107,7 +128,7 @@ class RestClient(requests.models.RequestEncodingMixin):
107
128
  :param user_agent: (optional) User Agent associated with the request, as a string.
108
129
  :param content_type: (optional) ContentType of the request, as a string.
109
130
  :param auth_method: (optional) Authentication type ex: Basic, HMAC etc
110
- :return: The TeleSign authentication headers.
131
+ :return: The Telesign authentication headers.
111
132
  """
112
133
  if date_rfc2616 is None:
113
134
  date_rfc2616 = formatdate(usegmt=True)
@@ -167,7 +188,7 @@ class RestClient(requests.models.RequestEncodingMixin):
167
188
 
168
189
  def post(self, resource, body=None, json_fields=None, **query_params):
169
190
  """
170
- Generic TeleSign REST API POST handler.
191
+ Generic Telesign REST API POST handler.
171
192
 
172
193
  :param resource: The partial resource URI to perform the request against, as a string.
173
194
  :param body: (optional) A dictionary sent as a part of request body.
@@ -178,7 +199,7 @@ class RestClient(requests.models.RequestEncodingMixin):
178
199
 
179
200
  def get(self, resource, body=None, json_fields=None, **query_params):
180
201
  """
181
- Generic TeleSign REST API GET handler.
202
+ Generic Telesign REST API GET handler.
182
203
 
183
204
  :param resource: The partial resource URI to perform the request against, as a string.
184
205
  :param body: (optional) A dictionary sent as a part of request body.
@@ -189,7 +210,7 @@ class RestClient(requests.models.RequestEncodingMixin):
189
210
 
190
211
  def put(self, resource, body=None, json_fields=None, **query_params):
191
212
  """
192
- Generic TeleSign REST API PUT handler.
213
+ Generic Telesign REST API PUT handler.
193
214
 
194
215
  :param resource: The partial resource URI to perform the request against, as a string.
195
216
  :param body: (optional) A dictionary sent as a part of request body.
@@ -198,9 +219,12 @@ class RestClient(requests.models.RequestEncodingMixin):
198
219
  """
199
220
  return self._execute(self.session.put, 'PUT', resource, body, json_fields, **query_params)
200
221
 
222
+ def set_endpoint(self, rest_endpoint):
223
+ self.api_host = rest_endpoint
224
+
201
225
  def delete(self, resource, body=None, json_fields=None, **query_params):
202
226
  """
203
- Generic TeleSign REST API DELETE handler.
227
+ Generic Telesign REST API DELETE handler.
204
228
 
205
229
  :param resource: The partial resource URI to perform the request against, as a string.
206
230
  :param body: (optional) A dictionary sent as a part of request body.
@@ -208,10 +232,33 @@ class RestClient(requests.models.RequestEncodingMixin):
208
232
  :return: The RestClient Response object.
209
233
  """
210
234
  return self._execute(self.session.delete, 'DELETE', resource, body, json_fields, **query_params)
235
+
236
+ def patch(self, resource, body=None, json_fields=None, **query_params):
237
+ """
238
+ Generic Telesign REST API PATCH handler.
239
+
240
+ :param resource: The partial resource URI to perform the request against, as a string.
241
+ :param body: (optional) A dictionary sent as a part of request body.
242
+ :param json_fields: (optional) A dictionary sent as a JSON body.
243
+ :param query_params: query_params to perform the PATCH request with, as a dictionary.
244
+ :return: The RestClient Response object.
245
+ """
246
+ return self._execute(self.session.patch, 'PATCH', resource, body, json_fields, **query_params)
247
+
248
+ def _create_session(self):
249
+ session = requests.Session()
250
+ self._session_created_at = time.time()
251
+ return session
252
+
253
+ def _ensure_session(self):
254
+ if self._session_created_at is None or (time.time() - self._session_created_at > self.pool_recycle):
255
+ if self.session:
256
+ self.session.close()
257
+ self.session = self._create_session()
211
258
 
212
259
  def _execute(self, method_function, method_name, resource, body=None, json_fields=None, **query_params):
213
260
  """
214
- Generic TeleSign REST API request handler.
261
+ Generic Telesign REST API request handler.
215
262
 
216
263
  :param method_function: The Requests HTTP request function to perform the request.
217
264
  :param method_name: The HTTP method name, as an upper case string.
@@ -220,6 +267,7 @@ class RestClient(requests.models.RequestEncodingMixin):
220
267
  :param query_params: query_params to perform the HTTP request with, as a dictionary.
221
268
  :return: The RestClient Response object.
222
269
  """
270
+ self._ensure_session()
223
271
  resource_uri = "{api_host}{resource}".format(api_host=self.api_host, resource=resource)
224
272
 
225
273
  url_encoded_fields = self._encode_params(query_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: telesign
3
- Version: 2.2.5
3
+ Version: 3.0.1
4
4
  Summary: TeleSign SDK
5
5
  Home-page: https://github.com/telesign/python_telesign
6
6
  Author: TeleSign Corp.
@@ -112,3 +112,9 @@ Classifier: Programming Language :: Python :: 3.3
112
112
  Classifier: Programming Language :: Python :: 3.4
113
113
  Classifier: Programming Language :: Python :: 3.5
114
114
  Classifier: Programming Language :: Python :: 3.6
115
+ Classifier: Programming Language :: Python :: 3.7
116
+ Classifier: Programming Language :: Python :: 3.8
117
+ Classifier: Programming Language :: Python :: 3.9
118
+ Classifier: Programming Language :: Python :: 3.10
119
+ Classifier: Programming Language :: Python :: 3.11
120
+ Classifier: Programming Language :: Python :: 3.12
@@ -3,8 +3,6 @@ MANIFEST.in
3
3
  README.rst
4
4
  setup.cfg
5
5
  setup.py
6
- examples/appverify/1_get_status_by_external_id.py
7
- examples/intelligence/1_get_risk_score_and_related_insights.py
8
6
  examples/messaging/1_send_message.py
9
7
  examples/messaging/2_send_message_with_verification_code.py
10
8
  examples/phoneid/1_check_phone_type_to_block_voip.py
@@ -14,8 +12,6 @@ examples/voice/1_send_voice_call.py
14
12
  examples/voice/2_send_voice_call_with_verification_code.py
15
13
  examples/voice/3_send_voice_call_french.py
16
14
  telesign/__init__.py
17
- telesign/appverify.py
18
- telesign/intelligence.py
19
15
  telesign/messaging.py
20
16
  telesign/phoneid.py
21
17
  telesign/rest.py
@@ -17,25 +17,6 @@ class TestPhoneId(TestCase):
17
17
  self.assertEqual(client.customer_id, self.customer_id)
18
18
  self.assertEqual(client.api_key, self.api_key)
19
19
 
20
-
21
- def test_phoneid_pid_contact(self):
22
-
23
- client = PhoneIdClient(self.customer_id, self.api_key)
24
- content_type_expected = 'application/json'
25
- status_code_expected = 200
26
-
27
- payload = {
28
- "addons": {
29
- "contact": {}
30
- },
31
- "phone_number": self.phone_number_test
32
- }
33
-
34
- response = client.phoneid(**payload)
35
-
36
- self.assertEqual(response.headers.get('Content-Type'), content_type_expected, "Content-Type args do not match expected")
37
- self.assertEqual(response.status_code, status_code_expected, "Status code args do not match expected")
38
-
39
20
  def test_phoneid_pid(self):
40
21
 
41
22
  client = PhoneIdClient(self.customer_id, self.api_key)
@@ -18,6 +18,7 @@ class TestRest(TestCase):
18
18
  def setUp(self):
19
19
  self.customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
20
20
  self.api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
21
+ self.rest_endpoint = "https://rest-api.telesign.com"
21
22
 
22
23
  def test_rest_client_constructor_basic(self):
23
24
 
@@ -43,6 +44,19 @@ class TestRest(TestCase):
43
44
  self.assertEqual(response.ok, requests_response.ok)
44
45
  self.assertEqual(response.json, requests_response.json())
45
46
 
47
+ def test_rest_client_response_constructor_from_full_service(self):
48
+
49
+ client = RestClient(self.customer_id,
50
+ self.api_key,
51
+ self.rest_endpoint,
52
+ "python_telesign_enterprise",
53
+ "1.0.0",
54
+ "2.0.0")
55
+
56
+ self.assertIn("OriginatingSDK/python_telesign_enterprise", client.user_agent)
57
+ self.assertIn("SDKVersion/1.0.0", client.user_agent)
58
+ self.assertIn("DependencySDKVersion/2.0.0", client.user_agent)
59
+
46
60
  def test_generate_telesign_headers_with_post(self):
47
61
  method_name = 'POST'
48
62
  date_rfc2616 = 'Wed, 14 Dec 2016 18:20:12 GMT'
@@ -276,4 +290,23 @@ class TestRest(TestCase):
276
290
  self.assertEqual(post_args, expected_post_args,
277
291
  "client.session.post.call_args args do not match expected")
278
292
  self.assertEqual(post_kwargs, expected_post_kwargs,
279
- "client.session.post.call_args kwargs do not match expected")
293
+ "client.session.post.call_args kwargs do not match expected")
294
+
295
+ def test_session_adapter_is_httpadapter(self):
296
+ client = RestClient(self.customer_id, self.api_key)
297
+ https_adapter = client.session.adapters["https://"]
298
+ import requests
299
+ self.assertIsInstance(https_adapter, requests.adapters.HTTPAdapter)
300
+
301
+ @patch("time.time")
302
+ def test_session_refresh_on_pool_recycle(self, mock_time):
303
+ # Simulate time to force session recycling
304
+ mock_time.return_value = 1000
305
+ client = RestClient(self.customer_id, self.api_key, pool_recycle=10)
306
+ created_at_first = client._session_created_at
307
+ # Advance time beyond the threshold
308
+ mock_time.return_value = 1012
309
+ # Force a request (any method calls _ensure_session)
310
+ client._ensure_session()
311
+ created_at_second = client._session_created_at
312
+ self.assertNotEqual(created_at_first, created_at_second)
@@ -1,16 +0,0 @@
1
- from __future__ import print_function
2
- from telesign.appverify import AppVerifyClient
3
-
4
- customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
5
- api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
6
-
7
- external_id = "external_id"
8
-
9
- appverify = AppVerifyClient(customer_id, api_key)
10
- response = appverify.status(external_id)
11
-
12
- if response.ok:
13
- print("App Verify transaction with external_id {} has status code {} and status description {}.".format(
14
- external_id,
15
- response.json['status']['code'],
16
- response.json['status']['description']))
@@ -1,29 +0,0 @@
1
- """Example code that makes requests to intelligence API."""
2
- from __future__ import print_function
3
- from telesign.intelligence import IntelligenceClient
4
-
5
- customer_1 = "your_customer_id-44ZA-47B5-95B9-ACXM9B1E5CAA"
6
- api_key_1 = "your_api_key_or_password"
7
-
8
- phone_number = "15555551212"
9
- account_lifecycle_event = "create"
10
-
11
- body = {
12
- "contact_details": {"email": "ghopper@gmail.com", "phone_number": "15555551212"},
13
- "external_id": "REG432538",
14
- "account_lifecycle_event": "create",
15
- "ip": "1.1.1.1",
16
- "device_id": "2e4fa042234d",
17
- }
18
-
19
- client = IntelligenceClient(customer_1, api_key_1)
20
- response = client.intelligence(body)
21
-
22
- if response.ok:
23
- print(
24
- "Phone number {} has a '{}' risk level and the score is '{}'.".format(
25
- response.json["phone_details"]["numbering"]["original"]["phone_number"],
26
- response.json["risk"]["level"],
27
- response.json["risk"]["score"],
28
- )
29
- )
@@ -1,28 +0,0 @@
1
- from __future__ import unicode_literals
2
-
3
- from telesign.rest import RestClient
4
-
5
- APPVERIFY_STATUS_RESOURCE = "/v1/mobile/verification/status/{external_id}"
6
-
7
-
8
- class AppVerifyClient(RestClient):
9
- """
10
- App Verify is a secure, lightweight SDK that integrates a frictionless user verification process into existing
11
- native mobile applications.
12
- """
13
-
14
- def __init__(self, customer_id, api_key, **kwargs):
15
- super(AppVerifyClient, self).__init__(customer_id, api_key, **kwargs)
16
-
17
- def status(self, external_id, **params):
18
- """
19
- Retrieves the verification result for an App Verify transaction by external_id. To ensure a secure verification
20
- flow you must check the status using TeleSign's servers on your backend. Do not rely on the SDK alone to
21
- indicate a successful verification.
22
-
23
- See https://developer.telesign.com/docs/app-verify-android-sdk-self#section-get-status-service or
24
- https://developer.telesign.com/docs/app-verify-ios-sdk-self#section-get-status-service for detailed
25
- API documentation.
26
- """
27
- return self.get(APPVERIFY_STATUS_RESOURCE.format(external_id=external_id),
28
- **params)
@@ -1,39 +0,0 @@
1
- """Client to make requests to intelligence API."""
2
- from __future__ import unicode_literals
3
-
4
- from telesign.rest import RestClient
5
- from telesign.util import AuthMethod
6
-
7
- INTELLIGENCE_BASE_URL = "https://detect.telesign.com"
8
- INTELLIGENCE_ENDPOINT_PATH = "/intelligence"
9
-
10
-
11
- class IntelligenceClient(RestClient):
12
- """
13
- It is critical today to evaluate fraud risk throughout the entire customer journey.
14
-
15
- Telesign Intelligence makes it easy to understand the risk and the reason behind it with tailored scoring models
16
- and comprehensive reason codes.
17
- """
18
-
19
- def __init__(self, customer_id, api_key, **kwargs):
20
- super(IntelligenceClient, self).__init__(
21
- customer_id=customer_id,
22
- api_key=api_key,
23
- rest_endpoint=INTELLIGENCE_BASE_URL,
24
- auth_method=AuthMethod.BASIC.value,
25
- **kwargs
26
- )
27
-
28
- def intelligence(self, params):
29
- """
30
- Telesign Intelligence is like a credit check for digital profiles.
31
-
32
- You submit a phone number, IP, and email to the service, the individual
33
- identifiers are each evaluated, and then a score is returned telling you how risky
34
- that user is. You decide whether to proceed based on the score.
35
-
36
- See https://developer.telesign.com/enterprise/docs/intelligence-overview
37
- for detailed API documentation.
38
- """
39
- return self.post(INTELLIGENCE_ENDPOINT_PATH, body=params, query_params=None)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes