telesign 2.2.3__tar.gz → 2.2.4__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 (37) hide show
  1. telesign-2.2.4/PKG-INFO +114 -0
  2. {telesign-2.2.3 → telesign-2.2.4}/setup.py +1 -1
  3. telesign-2.2.4/telesign/phoneid.py +28 -0
  4. {telesign-2.2.3 → telesign-2.2.4}/telesign/rest.py +20 -14
  5. telesign-2.2.4/telesign.egg-info/PKG-INFO +114 -0
  6. {telesign-2.2.3 → telesign-2.2.4}/telesign.egg-info/SOURCES.txt +1 -0
  7. telesign-2.2.4/tests/test_phoneid.py +48 -0
  8. telesign-2.2.3/PKG-INFO +0 -115
  9. telesign-2.2.3/telesign/phoneid.py +0 -54
  10. telesign-2.2.3/telesign.egg-info/PKG-INFO +0 -115
  11. {telesign-2.2.3 → telesign-2.2.4}/LICENSE.txt +0 -0
  12. {telesign-2.2.3 → telesign-2.2.4}/MANIFEST.in +0 -0
  13. {telesign-2.2.3 → telesign-2.2.4}/README.rst +0 -0
  14. {telesign-2.2.3 → telesign-2.2.4}/examples/appverify/1_get_status_by_external_id.py +0 -0
  15. {telesign-2.2.3 → telesign-2.2.4}/examples/intelligence/1_get_risk_score_and_related_insights.py +0 -0
  16. {telesign-2.2.3 → telesign-2.2.4}/examples/messaging/1_send_message.py +0 -0
  17. {telesign-2.2.3 → telesign-2.2.4}/examples/messaging/2_send_message_with_verification_code.py +0 -0
  18. {telesign-2.2.3 → telesign-2.2.4}/examples/phoneid/1_check_phone_type_to_block_voip.py +0 -0
  19. {telesign-2.2.3 → telesign-2.2.4}/examples/phoneid/2_cleansing.py +0 -0
  20. {telesign-2.2.3 → telesign-2.2.4}/examples/score/1_check_phone_number_risk_level.py +0 -0
  21. {telesign-2.2.3 → telesign-2.2.4}/examples/voice/1_send_voice_call.py +0 -0
  22. {telesign-2.2.3 → telesign-2.2.4}/examples/voice/2_send_voice_call_with_verification_code.py +0 -0
  23. {telesign-2.2.3 → telesign-2.2.4}/examples/voice/3_send_voice_call_french.py +0 -0
  24. {telesign-2.2.3 → telesign-2.2.4}/setup.cfg +0 -0
  25. {telesign-2.2.3 → telesign-2.2.4}/telesign/__init__.py +0 -0
  26. {telesign-2.2.3 → telesign-2.2.4}/telesign/appverify.py +0 -0
  27. {telesign-2.2.3 → telesign-2.2.4}/telesign/intelligence.py +0 -0
  28. {telesign-2.2.3 → telesign-2.2.4}/telesign/messaging.py +0 -0
  29. {telesign-2.2.3 → telesign-2.2.4}/telesign/score.py +0 -0
  30. {telesign-2.2.3 → telesign-2.2.4}/telesign/util.py +0 -0
  31. {telesign-2.2.3 → telesign-2.2.4}/telesign/voice.py +0 -0
  32. {telesign-2.2.3 → telesign-2.2.4}/telesign.egg-info/dependency_links.txt +0 -0
  33. {telesign-2.2.3 → telesign-2.2.4}/telesign.egg-info/requires.txt +0 -0
  34. {telesign-2.2.3 → telesign-2.2.4}/telesign.egg-info/top_level.txt +0 -0
  35. {telesign-2.2.3 → telesign-2.2.4}/tests/__init__.py +0 -0
  36. {telesign-2.2.3 → telesign-2.2.4}/tests/test_rest.py +0 -0
  37. {telesign-2.2.3 → telesign-2.2.4}/tests/test_util.py +0 -0
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 1.1
2
+ Name: telesign
3
+ Version: 2.2.4
4
+ Summary: TeleSign SDK
5
+ Home-page: https://github.com/telesign/python_telesign
6
+ Author: TeleSign Corp.
7
+ Author-email: support@telesign.com
8
+ License: MIT
9
+ Description: .. image:: https://raw.github.com/TeleSign/python_telesign/master/python_banner.jpg
10
+ :target: https://standard.telesign.com
11
+
12
+ .. image:: https://img.shields.io/travis/TeleSign/python_telesign.svg
13
+ :target: https://travis-ci.org/TeleSign/python_telesign
14
+
15
+ .. image:: https://img.shields.io/codecov/c/github/TeleSign/python_telesign.svg
16
+ :target: https://codecov.io/gh/TeleSign/python_telesign
17
+
18
+ .. image:: https://img.shields.io/pypi/v/telesign.svg
19
+ :target: https://pypi.python.org/pypi/telesign
20
+
21
+ .. image:: https://img.shields.io/pypi/l/telesign.svg
22
+ :target: https://github.com/TeleSign/python_telesign/blob/master/LICENSE
23
+
24
+ ===================
25
+ TeleSign Python SDK
26
+ ===================
27
+
28
+ TeleSign is a communications platform as a service (CPaaS) company, founded on security. Since 2005, TeleSign has
29
+ been a trusted partner to the world’s leading websites and mobile applications, helping secure billions of end-user
30
+ accounts. Today, TeleSign’s data-driven, cloud communications platform is changing the way businesses engage with
31
+ customers and prevent fraud.
32
+
33
+ For more information about TeleSign, visit our `website <http://www.TeleSign.com>`_.
34
+
35
+ Documentation
36
+ -------------
37
+
38
+ Code documentation is included in the SDK. Complete documentation, quick start guides and reference material
39
+ for the TeleSign API is available within the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
40
+
41
+ Installation
42
+ ------------
43
+
44
+ To install the TeleSign Python SDK:
45
+
46
+ .. code-block:: bash
47
+
48
+ $ pip install telesign
49
+
50
+ Python **2.7+** is required for the TeleSign Python SDK.
51
+
52
+ Authentication
53
+ --------------
54
+
55
+ You will need a Customer ID and API Key in order to use TeleSign’s API. If you already have an account you can retrieve
56
+ them from your account dashboard within the `Portal <https://portal.telesign.com/login>`_. If you have not signed up
57
+ yet, sign up `here <https://portal.telesign.com/signup>`_.
58
+
59
+ Dependencies
60
+ ------------
61
+
62
+ We make use of popular, feature-rich and well-tested open-source libraries to perform the underlying functionality of
63
+ the SDK. These dependencies are managed by the community accepted package manager. If you are unable to add these
64
+ additional third party dependencies to your project we have ensured that the SDK code is easy to read and can serve as
65
+ sample code. We have also made sure that more complicated functions such as generate_telesign_headers can be easily
66
+ extracted from the SDK and used 'as is' in your project.
67
+
68
+ Python Code Example: Messaging
69
+ ------------------------------
70
+
71
+ Here is a basic code example with the JSON response.
72
+
73
+ .. code-block:: python
74
+
75
+ from __future__ import print_function
76
+ from telesign.messaging import MessagingClient
77
+
78
+ customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
79
+ api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
80
+
81
+ phone_number = "phone_number"
82
+ message = "You're scheduled for a dentist appointment at 2:30PM."
83
+ message_type = "ARN"
84
+
85
+ messaging_client = MessagingClient(customer_id, api_key)
86
+ response = messaging_client.message(phone_number, message, message_type)
87
+
88
+ print(response.json)
89
+
90
+ .. code-block:: javascript
91
+
92
+ {'reference_id': 'DGFDF6E11AB86303ASDFD425BE00000657',
93
+ 'status': {'code': 103,
94
+ 'description': 'Call in progress',
95
+ 'updated_on': '2016-12-12T00:39:58.325559Z'}}
96
+
97
+ For more examples, see the `examples <https://github.com/TeleSign/python_telesign/tree/master/examples>`_ folder or
98
+ visit the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
99
+
100
+ Keywords: telesign,sms,voice,mobile,authentication,identity,messaging
101
+ Platform: UNKNOWN
102
+ Classifier: Development Status :: 5 - Production/Stable
103
+ Classifier: Intended Audience :: Developers
104
+ Classifier: License :: OSI Approved :: MIT License
105
+ Classifier: Natural Language :: English
106
+ Classifier: Programming Language :: Python
107
+ Classifier: Programming Language :: Python :: 2
108
+ Classifier: Programming Language :: Python :: 2.6
109
+ Classifier: Programming Language :: Python :: 2.7
110
+ Classifier: Programming Language :: Python :: 3
111
+ Classifier: Programming Language :: Python :: 3.3
112
+ Classifier: Programming Language :: Python :: 3.4
113
+ Classifier: Programming Language :: Python :: 3.5
114
+ Classifier: Programming Language :: Python :: 3.6
@@ -11,7 +11,7 @@ mock = ['mock'] if needs_mock else []
11
11
 
12
12
  here = path.abspath(path.dirname(__file__))
13
13
 
14
- version = "2.2.3"
14
+ version = "2.2.4"
15
15
 
16
16
  with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
17
17
  long_description = f.read()
@@ -0,0 +1,28 @@
1
+ from __future__ import unicode_literals
2
+
3
+ import json
4
+
5
+ from telesign.rest import RestClient
6
+
7
+ PHONEID_RESOURCE = "/v1/phoneid/{phone_number}"
8
+
9
+
10
+ class PhoneIdClient(RestClient):
11
+ """
12
+ A set of APIs that deliver deep phone number data attributes that help optimize the end user
13
+ verification process and evaluate risk.
14
+ """
15
+
16
+ def __init__(self, customer_id, api_key, **kwargs):
17
+ super(PhoneIdClient, self).__init__(customer_id, api_key, **kwargs)
18
+
19
+ def phoneid(self, phone_number, **params):
20
+ """
21
+ The PhoneID API provides a cleansed phone number, phone type, and telecom carrier information to determine the
22
+ best communication method - SMS or voice.
23
+
24
+ See https://developer.telesign.com/docs/phoneid-api for detailed API documentation.
25
+ """
26
+ return self.post(PHONEID_RESOURCE.format(phone_number=phone_number),
27
+ json_fields=params,
28
+ **params)
@@ -8,6 +8,7 @@ from hashlib import sha256
8
8
  from platform import python_version
9
9
 
10
10
  import requests
11
+ import json
11
12
 
12
13
  import telesign
13
14
  from telesign.util import AuthMethod
@@ -118,14 +119,14 @@ class RestClient(requests.models.RequestEncodingMixin):
118
119
  content_type = "application/x-www-form-urlencoded" if method_name in ("POST", "PUT") else ""
119
120
 
120
121
  # Default auth_method is Digest if not explicitly specified
121
- if auth_method == AuthMethod.BASIC.value:
122
+ if auth_method == AuthMethod.BASIC:
122
123
  usr_apikey = "{customer_id}:{api_key}".format(customer_id=customer_id,
123
124
  api_key=api_key)
124
125
  b64val = b64encode(usr_apikey.encode())
125
- authorization = "{auth_method} {b64val}".format(auth_method=AuthMethod.BASIC.value,
126
+ authorization = "{auth_method} {b64val}".format(auth_method=AuthMethod.BASIC,
126
127
  b64val=b64val.decode())
127
128
  else:
128
- auth_method = AuthMethod.HMAC_SHA256.value
129
+ auth_method = AuthMethod.HMAC_SHA256
129
130
 
130
131
  string_to_sign_builder = ["{method}".format(method=method_name)]
131
132
 
@@ -164,7 +165,7 @@ class RestClient(requests.models.RequestEncodingMixin):
164
165
 
165
166
  return headers
166
167
 
167
- def post(self, resource, body=None, **query_params):
168
+ def post(self, resource, body=None, json_fields=None, **query_params):
168
169
  """
169
170
  Generic TeleSign REST API POST handler.
170
171
 
@@ -173,9 +174,9 @@ class RestClient(requests.models.RequestEncodingMixin):
173
174
  :param query_params: query_params to perform the POST request with, as a dictionary.
174
175
  :return: The RestClient Response object.
175
176
  """
176
- return self._execute(self.session.post, 'POST', resource, body, **query_params)
177
+ return self._execute(self.session.post, 'POST', resource, body, json_fields, **query_params)
177
178
 
178
- def get(self, resource, body=None, **query_params):
179
+ def get(self, resource, body=None, json_fields=None, **query_params):
179
180
  """
180
181
  Generic TeleSign REST API GET handler.
181
182
 
@@ -184,9 +185,9 @@ class RestClient(requests.models.RequestEncodingMixin):
184
185
  :param query_params: query_params to perform the GET request with, as a dictionary.
185
186
  :return: The RestClient Response object.
186
187
  """
187
- return self._execute(self.session.get, 'GET', resource, body, **query_params)
188
+ return self._execute(self.session.get, 'GET', resource, body, json_fields, **query_params)
188
189
 
189
- def put(self, resource, body=None, **query_params):
190
+ def put(self, resource, body=None, json_fields=None, **query_params):
190
191
  """
191
192
  Generic TeleSign REST API PUT handler.
192
193
 
@@ -195,9 +196,9 @@ class RestClient(requests.models.RequestEncodingMixin):
195
196
  :param query_params: query_params to perform the PUT request with, as a dictionary.
196
197
  :return: The RestClient Response object.
197
198
  """
198
- return self._execute(self.session.put, 'PUT', resource, body, **query_params)
199
+ return self._execute(self.session.put, 'PUT', resource, body, json_fields, **query_params)
199
200
 
200
- def delete(self, resource, body=None, **query_params):
201
+ def delete(self, resource, body=None, json_fields=None, **query_params):
201
202
  """
202
203
  Generic TeleSign REST API DELETE handler.
203
204
 
@@ -206,9 +207,9 @@ class RestClient(requests.models.RequestEncodingMixin):
206
207
  :param query_params: query_params to perform the DELETE request with, as a dictionary.
207
208
  :return: The RestClient Response object.
208
209
  """
209
- return self._execute(self.session.delete, 'DELETE', resource, body, **query_params)
210
+ return self._execute(self.session.delete, 'DELETE', resource, body, json_fields, **query_params)
210
211
 
211
- def _execute(self, method_function, method_name, resource, body=None, **query_params):
212
+ def _execute(self, method_function, method_name, resource, body=None, json_fields=None, **query_params):
212
213
  """
213
214
  Generic TeleSign REST API request handler.
214
215
 
@@ -222,7 +223,11 @@ class RestClient(requests.models.RequestEncodingMixin):
222
223
  resource_uri = "{api_host}{resource}".format(api_host=self.api_host, resource=resource)
223
224
 
224
225
  url_encoded_fields = self._encode_params(query_params)
225
- if body:
226
+ if json_fields:
227
+ fields = json.dumps(json_fields)
228
+ url_encoded_fields = fields
229
+
230
+ if body or json_fields:
226
231
  content_type = "application/json"
227
232
  else:
228
233
  content_type = None # set later
@@ -235,13 +240,14 @@ class RestClient(requests.models.RequestEncodingMixin):
235
240
  user_agent=self.user_agent,
236
241
  content_type=content_type,
237
242
  auth_method=self.auth_method)
238
-
239
243
  if method_name in ['POST', 'PUT']:
240
244
  payload = {}
241
245
  if body:
242
246
  payload['json'] = body
243
247
  if query_params:
244
248
  payload['data'] = url_encoded_fields
249
+ if json_fields:
250
+ payload = {'data': url_encoded_fields}
245
251
  else:
246
252
  payload = {'params': url_encoded_fields}
247
253
 
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 1.1
2
+ Name: telesign
3
+ Version: 2.2.4
4
+ Summary: TeleSign SDK
5
+ Home-page: https://github.com/telesign/python_telesign
6
+ Author: TeleSign Corp.
7
+ Author-email: support@telesign.com
8
+ License: MIT
9
+ Description: .. image:: https://raw.github.com/TeleSign/python_telesign/master/python_banner.jpg
10
+ :target: https://standard.telesign.com
11
+
12
+ .. image:: https://img.shields.io/travis/TeleSign/python_telesign.svg
13
+ :target: https://travis-ci.org/TeleSign/python_telesign
14
+
15
+ .. image:: https://img.shields.io/codecov/c/github/TeleSign/python_telesign.svg
16
+ :target: https://codecov.io/gh/TeleSign/python_telesign
17
+
18
+ .. image:: https://img.shields.io/pypi/v/telesign.svg
19
+ :target: https://pypi.python.org/pypi/telesign
20
+
21
+ .. image:: https://img.shields.io/pypi/l/telesign.svg
22
+ :target: https://github.com/TeleSign/python_telesign/blob/master/LICENSE
23
+
24
+ ===================
25
+ TeleSign Python SDK
26
+ ===================
27
+
28
+ TeleSign is a communications platform as a service (CPaaS) company, founded on security. Since 2005, TeleSign has
29
+ been a trusted partner to the world’s leading websites and mobile applications, helping secure billions of end-user
30
+ accounts. Today, TeleSign’s data-driven, cloud communications platform is changing the way businesses engage with
31
+ customers and prevent fraud.
32
+
33
+ For more information about TeleSign, visit our `website <http://www.TeleSign.com>`_.
34
+
35
+ Documentation
36
+ -------------
37
+
38
+ Code documentation is included in the SDK. Complete documentation, quick start guides and reference material
39
+ for the TeleSign API is available within the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
40
+
41
+ Installation
42
+ ------------
43
+
44
+ To install the TeleSign Python SDK:
45
+
46
+ .. code-block:: bash
47
+
48
+ $ pip install telesign
49
+
50
+ Python **2.7+** is required for the TeleSign Python SDK.
51
+
52
+ Authentication
53
+ --------------
54
+
55
+ You will need a Customer ID and API Key in order to use TeleSign’s API. If you already have an account you can retrieve
56
+ them from your account dashboard within the `Portal <https://portal.telesign.com/login>`_. If you have not signed up
57
+ yet, sign up `here <https://portal.telesign.com/signup>`_.
58
+
59
+ Dependencies
60
+ ------------
61
+
62
+ We make use of popular, feature-rich and well-tested open-source libraries to perform the underlying functionality of
63
+ the SDK. These dependencies are managed by the community accepted package manager. If you are unable to add these
64
+ additional third party dependencies to your project we have ensured that the SDK code is easy to read and can serve as
65
+ sample code. We have also made sure that more complicated functions such as generate_telesign_headers can be easily
66
+ extracted from the SDK and used 'as is' in your project.
67
+
68
+ Python Code Example: Messaging
69
+ ------------------------------
70
+
71
+ Here is a basic code example with the JSON response.
72
+
73
+ .. code-block:: python
74
+
75
+ from __future__ import print_function
76
+ from telesign.messaging import MessagingClient
77
+
78
+ customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
79
+ api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
80
+
81
+ phone_number = "phone_number"
82
+ message = "You're scheduled for a dentist appointment at 2:30PM."
83
+ message_type = "ARN"
84
+
85
+ messaging_client = MessagingClient(customer_id, api_key)
86
+ response = messaging_client.message(phone_number, message, message_type)
87
+
88
+ print(response.json)
89
+
90
+ .. code-block:: javascript
91
+
92
+ {'reference_id': 'DGFDF6E11AB86303ASDFD425BE00000657',
93
+ 'status': {'code': 103,
94
+ 'description': 'Call in progress',
95
+ 'updated_on': '2016-12-12T00:39:58.325559Z'}}
96
+
97
+ For more examples, see the `examples <https://github.com/TeleSign/python_telesign/tree/master/examples>`_ folder or
98
+ visit the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
99
+
100
+ Keywords: telesign,sms,voice,mobile,authentication,identity,messaging
101
+ Platform: UNKNOWN
102
+ Classifier: Development Status :: 5 - Production/Stable
103
+ Classifier: Intended Audience :: Developers
104
+ Classifier: License :: OSI Approved :: MIT License
105
+ Classifier: Natural Language :: English
106
+ Classifier: Programming Language :: Python
107
+ Classifier: Programming Language :: Python :: 2
108
+ Classifier: Programming Language :: Python :: 2.6
109
+ Classifier: Programming Language :: Python :: 2.7
110
+ Classifier: Programming Language :: Python :: 3
111
+ Classifier: Programming Language :: Python :: 3.3
112
+ Classifier: Programming Language :: Python :: 3.4
113
+ Classifier: Programming Language :: Python :: 3.5
114
+ Classifier: Programming Language :: Python :: 3.6
@@ -28,5 +28,6 @@ telesign.egg-info/dependency_links.txt
28
28
  telesign.egg-info/requires.txt
29
29
  telesign.egg-info/top_level.txt
30
30
  tests/__init__.py
31
+ tests/test_phoneid.py
31
32
  tests/test_rest.py
32
33
  tests/test_util.py
@@ -0,0 +1,48 @@
1
+ from __future__ import unicode_literals
2
+ import os
3
+ from unittest import TestCase
4
+ from telesign.phoneid import PhoneIdClient
5
+
6
+ class TestPhoneId(TestCase):
7
+ def setUp(self):
8
+ self.customer_id = os.getenv('CUSTOMER_ID', 'FFFFFFFF-EEEE-DDDD-1234-AB1234567890')
9
+ self.api_key = os.getenv('API_KEY', 'EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==')
10
+ self.phone_number_test = "11234567890"
11
+
12
+ def test_phoneid_constructor(self):
13
+
14
+ client = PhoneIdClient(self.customer_id,
15
+ self.api_key)
16
+
17
+ self.assertEqual(client.customer_id, self.customer_id)
18
+ self.assertEqual(client.api_key, self.api_key)
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
+ def test_phoneid_pid(self):
40
+
41
+ client = PhoneIdClient(self.customer_id, self.api_key)
42
+ content_type_expected = 'application/json'
43
+ status_code_expected = 200
44
+
45
+ response = client.phoneid(self.phone_number_test)
46
+
47
+ self.assertEqual(response.headers.get('Content-Type'), content_type_expected, "Content-Type args do not match expected")
48
+ self.assertEqual(response.status_code, status_code_expected, "Status code args do not match expected")
telesign-2.2.3/PKG-INFO DELETED
@@ -1,115 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: telesign
3
- Version: 2.2.3
4
- Summary: TeleSign SDK
5
- Home-page: https://github.com/telesign/python_telesign
6
- Author: TeleSign Corp.
7
- Author-email: support@telesign.com
8
- License: MIT
9
- Keywords: telesign,sms,voice,mobile,authentication,identity,messaging
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 2
16
- Classifier: Programming Language :: Python :: 2.6
17
- Classifier: Programming Language :: Python :: 2.7
18
- Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.3
20
- Classifier: Programming Language :: Python :: 3.4
21
- Classifier: Programming Language :: Python :: 3.5
22
- Classifier: Programming Language :: Python :: 3.6
23
- License-File: LICENSE.txt
24
- Requires-Dist: requests
25
-
26
- .. image:: https://raw.github.com/TeleSign/python_telesign/master/python_banner.jpg
27
- :target: https://standard.telesign.com
28
-
29
- .. image:: https://img.shields.io/travis/TeleSign/python_telesign.svg
30
- :target: https://travis-ci.org/TeleSign/python_telesign
31
-
32
- .. image:: https://img.shields.io/codecov/c/github/TeleSign/python_telesign.svg
33
- :target: https://codecov.io/gh/TeleSign/python_telesign
34
-
35
- .. image:: https://img.shields.io/pypi/v/telesign.svg
36
- :target: https://pypi.python.org/pypi/telesign
37
-
38
- .. image:: https://img.shields.io/pypi/l/telesign.svg
39
- :target: https://github.com/TeleSign/python_telesign/blob/master/LICENSE
40
-
41
- ===================
42
- TeleSign Python SDK
43
- ===================
44
-
45
- TeleSign is a communications platform as a service (CPaaS) company, founded on security. Since 2005, TeleSign has
46
- been a trusted partner to the world’s leading websites and mobile applications, helping secure billions of end-user
47
- accounts. Today, TeleSign’s data-driven, cloud communications platform is changing the way businesses engage with
48
- customers and prevent fraud.
49
-
50
- For more information about TeleSign, visit our `website <http://www.TeleSign.com>`_.
51
-
52
- Documentation
53
- -------------
54
-
55
- Code documentation is included in the SDK. Complete documentation, quick start guides and reference material
56
- for the TeleSign API is available within the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
57
-
58
- Installation
59
- ------------
60
-
61
- To install the TeleSign Python SDK:
62
-
63
- .. code-block:: bash
64
-
65
- $ pip install telesign
66
-
67
- Python **2.7+** is required for the TeleSign Python SDK.
68
-
69
- Authentication
70
- --------------
71
-
72
- You will need a Customer ID and API Key in order to use TeleSign’s API. If you already have an account you can retrieve
73
- them from your account dashboard within the `Portal <https://portal.telesign.com/login>`_. If you have not signed up
74
- yet, sign up `here <https://portal.telesign.com/signup>`_.
75
-
76
- Dependencies
77
- ------------
78
-
79
- We make use of popular, feature-rich and well-tested open-source libraries to perform the underlying functionality of
80
- the SDK. These dependencies are managed by the community accepted package manager. If you are unable to add these
81
- additional third party dependencies to your project we have ensured that the SDK code is easy to read and can serve as
82
- sample code. We have also made sure that more complicated functions such as generate_telesign_headers can be easily
83
- extracted from the SDK and used 'as is' in your project.
84
-
85
- Python Code Example: Messaging
86
- ------------------------------
87
-
88
- Here is a basic code example with the JSON response.
89
-
90
- .. code-block:: python
91
-
92
- from __future__ import print_function
93
- from telesign.messaging import MessagingClient
94
-
95
- customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
96
- api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
97
-
98
- phone_number = "phone_number"
99
- message = "You're scheduled for a dentist appointment at 2:30PM."
100
- message_type = "ARN"
101
-
102
- messaging_client = MessagingClient(customer_id, api_key)
103
- response = messaging_client.message(phone_number, message, message_type)
104
-
105
- print(response.json)
106
-
107
- .. code-block:: javascript
108
-
109
- {'reference_id': 'DGFDF6E11AB86303ASDFD425BE00000657',
110
- 'status': {'code': 103,
111
- 'description': 'Call in progress',
112
- 'updated_on': '2016-12-12T00:39:58.325559Z'}}
113
-
114
- For more examples, see the `examples <https://github.com/TeleSign/python_telesign/tree/master/examples>`_ folder or
115
- visit the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
@@ -1,54 +0,0 @@
1
- from __future__ import unicode_literals
2
-
3
- import json
4
-
5
- from telesign.rest import RestClient
6
-
7
- PHONEID_RESOURCE = "/v1/phoneid/{phone_number}"
8
-
9
-
10
- class PhoneIdClient(RestClient):
11
- """
12
- A set of APIs that deliver deep phone number data attributes that help optimize the end user
13
- verification process and evaluate risk.
14
- """
15
-
16
- def __init__(self, customer_id, api_key, **kwargs):
17
- super(PhoneIdClient, self).__init__(customer_id, api_key, **kwargs)
18
-
19
- def phoneid(self, phone_number, **params):
20
- """
21
- The PhoneID API provides a cleansed phone number, phone type, and telecom carrier information to determine the
22
- best communication method - SMS or voice.
23
-
24
- See https://developer.telesign.com/docs/phoneid-api for detailed API documentation.
25
- """
26
- return self.post(PHONEID_RESOURCE.format(phone_number=phone_number),
27
- **params)
28
-
29
- def _execute(self, method_function, method_name, resource, **params):
30
- resource_uri = "{api_host}{resource}".format(api_host=self.api_host, resource=resource)
31
-
32
- json_fields = json.dumps(params)
33
-
34
- content_type = "application/json" if method_name in ("POST", "PUT") else ""
35
-
36
- headers = self.generate_telesign_headers(self.customer_id,
37
- self.api_key,
38
- method_name,
39
- resource,
40
- json_fields,
41
- user_agent=self.user_agent,
42
- content_type=content_type)
43
-
44
- if method_name in ['POST', 'PUT']:
45
- payload = {'data': json_fields}
46
- else:
47
- payload = {'params': json_fields}
48
-
49
- response = self.Response(method_function(resource_uri,
50
- headers=headers,
51
- timeout=self.timeout,
52
- **payload))
53
-
54
- return response
@@ -1,115 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: telesign
3
- Version: 2.2.3
4
- Summary: TeleSign SDK
5
- Home-page: https://github.com/telesign/python_telesign
6
- Author: TeleSign Corp.
7
- Author-email: support@telesign.com
8
- License: MIT
9
- Keywords: telesign,sms,voice,mobile,authentication,identity,messaging
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 2
16
- Classifier: Programming Language :: Python :: 2.6
17
- Classifier: Programming Language :: Python :: 2.7
18
- Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.3
20
- Classifier: Programming Language :: Python :: 3.4
21
- Classifier: Programming Language :: Python :: 3.5
22
- Classifier: Programming Language :: Python :: 3.6
23
- License-File: LICENSE.txt
24
- Requires-Dist: requests
25
-
26
- .. image:: https://raw.github.com/TeleSign/python_telesign/master/python_banner.jpg
27
- :target: https://standard.telesign.com
28
-
29
- .. image:: https://img.shields.io/travis/TeleSign/python_telesign.svg
30
- :target: https://travis-ci.org/TeleSign/python_telesign
31
-
32
- .. image:: https://img.shields.io/codecov/c/github/TeleSign/python_telesign.svg
33
- :target: https://codecov.io/gh/TeleSign/python_telesign
34
-
35
- .. image:: https://img.shields.io/pypi/v/telesign.svg
36
- :target: https://pypi.python.org/pypi/telesign
37
-
38
- .. image:: https://img.shields.io/pypi/l/telesign.svg
39
- :target: https://github.com/TeleSign/python_telesign/blob/master/LICENSE
40
-
41
- ===================
42
- TeleSign Python SDK
43
- ===================
44
-
45
- TeleSign is a communications platform as a service (CPaaS) company, founded on security. Since 2005, TeleSign has
46
- been a trusted partner to the world’s leading websites and mobile applications, helping secure billions of end-user
47
- accounts. Today, TeleSign’s data-driven, cloud communications platform is changing the way businesses engage with
48
- customers and prevent fraud.
49
-
50
- For more information about TeleSign, visit our `website <http://www.TeleSign.com>`_.
51
-
52
- Documentation
53
- -------------
54
-
55
- Code documentation is included in the SDK. Complete documentation, quick start guides and reference material
56
- for the TeleSign API is available within the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
57
-
58
- Installation
59
- ------------
60
-
61
- To install the TeleSign Python SDK:
62
-
63
- .. code-block:: bash
64
-
65
- $ pip install telesign
66
-
67
- Python **2.7+** is required for the TeleSign Python SDK.
68
-
69
- Authentication
70
- --------------
71
-
72
- You will need a Customer ID and API Key in order to use TeleSign’s API. If you already have an account you can retrieve
73
- them from your account dashboard within the `Portal <https://portal.telesign.com/login>`_. If you have not signed up
74
- yet, sign up `here <https://portal.telesign.com/signup>`_.
75
-
76
- Dependencies
77
- ------------
78
-
79
- We make use of popular, feature-rich and well-tested open-source libraries to perform the underlying functionality of
80
- the SDK. These dependencies are managed by the community accepted package manager. If you are unable to add these
81
- additional third party dependencies to your project we have ensured that the SDK code is easy to read and can serve as
82
- sample code. We have also made sure that more complicated functions such as generate_telesign_headers can be easily
83
- extracted from the SDK and used 'as is' in your project.
84
-
85
- Python Code Example: Messaging
86
- ------------------------------
87
-
88
- Here is a basic code example with the JSON response.
89
-
90
- .. code-block:: python
91
-
92
- from __future__ import print_function
93
- from telesign.messaging import MessagingClient
94
-
95
- customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
96
- api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
97
-
98
- phone_number = "phone_number"
99
- message = "You're scheduled for a dentist appointment at 2:30PM."
100
- message_type = "ARN"
101
-
102
- messaging_client = MessagingClient(customer_id, api_key)
103
- response = messaging_client.message(phone_number, message, message_type)
104
-
105
- print(response.json)
106
-
107
- .. code-block:: javascript
108
-
109
- {'reference_id': 'DGFDF6E11AB86303ASDFD425BE00000657',
110
- 'status': {'code': 103,
111
- 'description': 'Call in progress',
112
- 'updated_on': '2016-12-12T00:39:58.325559Z'}}
113
-
114
- For more examples, see the `examples <https://github.com/TeleSign/python_telesign/tree/master/examples>`_ folder or
115
- visit the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
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
File without changes
File without changes