telesign 2.2.2__tar.gz → 2.2.3__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.
- {telesign-2.2.2 → telesign-2.2.3}/LICENSE.txt +7 -7
- telesign-2.2.3/PKG-INFO +115 -0
- {telesign-2.2.2 → telesign-2.2.3}/README.rst +8 -8
- telesign-2.2.3/examples/intelligence/1_get_risk_score_and_related_insights.py +29 -0
- {telesign-2.2.2 → telesign-2.2.3}/setup.py +1 -1
- telesign-2.2.3/telesign/intelligence.py +39 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/rest.py +63 -35
- {telesign-2.2.2 → telesign-2.2.3}/telesign/util.py +6 -0
- telesign-2.2.3/telesign.egg-info/PKG-INFO +115 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign.egg-info/SOURCES.txt +2 -0
- {telesign-2.2.2 → telesign-2.2.3}/tests/test_rest.py +68 -0
- telesign-2.2.2/PKG-INFO +0 -114
- telesign-2.2.2/telesign.egg-info/PKG-INFO +0 -114
- {telesign-2.2.2 → telesign-2.2.3}/MANIFEST.in +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/appverify/1_get_status_by_external_id.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/messaging/1_send_message.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/messaging/2_send_message_with_verification_code.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/phoneid/1_check_phone_type_to_block_voip.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/phoneid/2_cleansing.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/score/1_check_phone_number_risk_level.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/voice/1_send_voice_call.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/voice/2_send_voice_call_with_verification_code.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/examples/voice/3_send_voice_call_french.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/setup.cfg +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/__init__.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/appverify.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/messaging.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/phoneid.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/score.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign/voice.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign.egg-info/dependency_links.txt +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign.egg-info/requires.txt +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/telesign.egg-info/top_level.txt +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/tests/__init__.py +0 -0
- {telesign-2.2.2 → telesign-2.2.3}/tests/test_util.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2023 Telesign Corp.
|
|
2
2
|
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
the Software without restriction, including without limitation the rights
|
|
6
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
of the Software, and to permit persons to whom the Software is
|
|
8
|
-
so, subject to the following conditions:
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
9
|
|
|
10
10
|
The above copyright notice and this permission notice shall be included in all
|
|
11
11
|
copies or substantial portions of the Software.
|
telesign-2.2.3/PKG-INFO
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
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,17 +1,17 @@
|
|
|
1
1
|
.. image:: https://raw.github.com/TeleSign/python_telesign/master/python_banner.jpg
|
|
2
|
-
|
|
2
|
+
:target: https://standard.telesign.com
|
|
3
3
|
|
|
4
4
|
.. image:: https://img.shields.io/travis/TeleSign/python_telesign.svg
|
|
5
|
-
|
|
5
|
+
:target: https://travis-ci.org/TeleSign/python_telesign
|
|
6
6
|
|
|
7
7
|
.. image:: https://img.shields.io/codecov/c/github/TeleSign/python_telesign.svg
|
|
8
|
-
|
|
8
|
+
:target: https://codecov.io/gh/TeleSign/python_telesign
|
|
9
9
|
|
|
10
10
|
.. image:: https://img.shields.io/pypi/v/telesign.svg
|
|
11
|
-
|
|
11
|
+
:target: https://pypi.python.org/pypi/telesign
|
|
12
12
|
|
|
13
13
|
.. image:: https://img.shields.io/pypi/l/telesign.svg
|
|
14
|
-
|
|
14
|
+
:target: https://github.com/TeleSign/python_telesign/blob/master/LICENSE
|
|
15
15
|
|
|
16
16
|
===================
|
|
17
17
|
TeleSign Python SDK
|
|
@@ -28,7 +28,7 @@ Documentation
|
|
|
28
28
|
-------------
|
|
29
29
|
|
|
30
30
|
Code documentation is included in the SDK. Complete documentation, quick start guides and reference material
|
|
31
|
-
for the TeleSign API is available within the `TeleSign
|
|
31
|
+
for the TeleSign API is available within the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
|
|
32
32
|
|
|
33
33
|
Installation
|
|
34
34
|
------------
|
|
@@ -80,11 +80,11 @@ Here is a basic code example with the JSON response.
|
|
|
80
80
|
print(response.json)
|
|
81
81
|
|
|
82
82
|
.. code-block:: javascript
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
{'reference_id': 'DGFDF6E11AB86303ASDFD425BE00000657',
|
|
85
85
|
'status': {'code': 103,
|
|
86
86
|
'description': 'Call in progress',
|
|
87
87
|
'updated_on': '2016-12-12T00:39:58.325559Z'}}
|
|
88
88
|
|
|
89
89
|
For more examples, see the `examples <https://github.com/TeleSign/python_telesign/tree/master/examples>`_ folder or
|
|
90
|
-
visit the `TeleSign
|
|
90
|
+
visit the `TeleSign Standard Documentation <https://standard.telesign.com/>`_.
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
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)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import unicode_literals
|
|
2
2
|
|
|
3
|
-
from requests import post
|
|
4
3
|
import hmac
|
|
5
4
|
import uuid
|
|
6
5
|
from base64 import b64encode, b64decode
|
|
@@ -11,6 +10,7 @@ from platform import python_version
|
|
|
11
10
|
import requests
|
|
12
11
|
|
|
13
12
|
import telesign
|
|
13
|
+
from telesign.util import AuthMethod
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class RestClient(requests.models.RequestEncodingMixin):
|
|
@@ -51,7 +51,8 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
51
51
|
api_key,
|
|
52
52
|
rest_endpoint='https://rest-api.telesign.com',
|
|
53
53
|
proxies=None,
|
|
54
|
-
timeout=10
|
|
54
|
+
timeout=10,
|
|
55
|
+
auth_method=None):
|
|
55
56
|
"""
|
|
56
57
|
TeleSign RestClient useful for making generic RESTful requests against our API.
|
|
57
58
|
|
|
@@ -73,6 +74,8 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
73
74
|
|
|
74
75
|
self.timeout = timeout
|
|
75
76
|
|
|
77
|
+
self.auth_method = auth_method
|
|
78
|
+
|
|
76
79
|
@staticmethod
|
|
77
80
|
def generate_telesign_headers(customer_id,
|
|
78
81
|
api_key,
|
|
@@ -82,7 +85,8 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
82
85
|
date_rfc2616=None,
|
|
83
86
|
nonce=None,
|
|
84
87
|
user_agent=None,
|
|
85
|
-
content_type=None
|
|
88
|
+
content_type=None,
|
|
89
|
+
auth_method=None):
|
|
86
90
|
"""
|
|
87
91
|
Generates the TeleSign REST API headers used to authenticate requests.
|
|
88
92
|
|
|
@@ -101,6 +105,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
101
105
|
:param nonce: A unique cryptographic nonce for the request, as a string.
|
|
102
106
|
:param user_agent: (optional) User Agent associated with the request, as a string.
|
|
103
107
|
:param content_type: (optional) ContentType of the request, as a string.
|
|
108
|
+
:param auth_method: (optional) Authentication type ex: Basic, HMAC etc
|
|
104
109
|
:return: The TeleSign authentication headers.
|
|
105
110
|
"""
|
|
106
111
|
if date_rfc2616 is None:
|
|
@@ -112,31 +117,39 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
112
117
|
if not content_type:
|
|
113
118
|
content_type = "application/x-www-form-urlencoded" if method_name in ("POST", "PUT") else ""
|
|
114
119
|
|
|
115
|
-
auth_method
|
|
120
|
+
# Default auth_method is Digest if not explicitly specified
|
|
121
|
+
if auth_method == AuthMethod.BASIC.value:
|
|
122
|
+
usr_apikey = "{customer_id}:{api_key}".format(customer_id=customer_id,
|
|
123
|
+
api_key=api_key)
|
|
124
|
+
b64val = b64encode(usr_apikey.encode())
|
|
125
|
+
authorization = "{auth_method} {b64val}".format(auth_method=AuthMethod.BASIC.value,
|
|
126
|
+
b64val=b64val.decode())
|
|
127
|
+
else:
|
|
128
|
+
auth_method = AuthMethod.HMAC_SHA256.value
|
|
116
129
|
|
|
117
|
-
|
|
130
|
+
string_to_sign_builder = ["{method}".format(method=method_name)]
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
string_to_sign_builder.append("\n{content_type}".format(content_type=content_type))
|
|
120
133
|
|
|
121
|
-
|
|
134
|
+
string_to_sign_builder.append("\n{date}".format(date=date_rfc2616))
|
|
122
135
|
|
|
123
|
-
|
|
136
|
+
string_to_sign_builder.append("\nx-ts-auth-method:{auth_method}".format(auth_method=auth_method))
|
|
124
137
|
|
|
125
|
-
|
|
138
|
+
string_to_sign_builder.append("\nx-ts-nonce:{nonce}".format(nonce=nonce))
|
|
126
139
|
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
if content_type and url_encoded_fields:
|
|
141
|
+
string_to_sign_builder.append("\n{fields}".format(fields=url_encoded_fields))
|
|
129
142
|
|
|
130
|
-
|
|
143
|
+
string_to_sign_builder.append("\n{resource}".format(resource=resource))
|
|
131
144
|
|
|
132
|
-
|
|
145
|
+
string_to_sign = "".join(string_to_sign_builder)
|
|
133
146
|
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
signer = hmac.new(b64decode(api_key), string_to_sign.encode("utf-8"), sha256)
|
|
148
|
+
signature = b64encode(signer.digest()).decode("utf-8")
|
|
136
149
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
authorization = "TSA {customer_id}:{signature}".format(
|
|
151
|
+
customer_id=customer_id,
|
|
152
|
+
signature=signature)
|
|
140
153
|
|
|
141
154
|
headers = {
|
|
142
155
|
"Authorization": authorization,
|
|
@@ -151,69 +164,84 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
151
164
|
|
|
152
165
|
return headers
|
|
153
166
|
|
|
154
|
-
def post(self, resource, **
|
|
167
|
+
def post(self, resource, body=None, **query_params):
|
|
155
168
|
"""
|
|
156
169
|
Generic TeleSign REST API POST handler.
|
|
157
170
|
|
|
158
171
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
159
|
-
:param
|
|
172
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
173
|
+
:param query_params: query_params to perform the POST request with, as a dictionary.
|
|
160
174
|
:return: The RestClient Response object.
|
|
161
175
|
"""
|
|
162
|
-
return self._execute(self.session.post, 'POST', resource, **
|
|
176
|
+
return self._execute(self.session.post, 'POST', resource, body, **query_params)
|
|
163
177
|
|
|
164
|
-
def get(self, resource, **
|
|
178
|
+
def get(self, resource, body=None, **query_params):
|
|
165
179
|
"""
|
|
166
180
|
Generic TeleSign REST API GET handler.
|
|
167
181
|
|
|
168
182
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
169
|
-
:param
|
|
183
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
184
|
+
:param query_params: query_params to perform the GET request with, as a dictionary.
|
|
170
185
|
:return: The RestClient Response object.
|
|
171
186
|
"""
|
|
172
|
-
return self._execute(self.session.get, 'GET', resource, **
|
|
187
|
+
return self._execute(self.session.get, 'GET', resource, body, **query_params)
|
|
173
188
|
|
|
174
|
-
def put(self, resource, **
|
|
189
|
+
def put(self, resource, body=None, **query_params):
|
|
175
190
|
"""
|
|
176
191
|
Generic TeleSign REST API PUT handler.
|
|
177
192
|
|
|
178
193
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
179
|
-
:param
|
|
194
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
195
|
+
:param query_params: query_params to perform the PUT request with, as a dictionary.
|
|
180
196
|
:return: The RestClient Response object.
|
|
181
197
|
"""
|
|
182
|
-
return self._execute(self.session.put, 'PUT', resource, **
|
|
198
|
+
return self._execute(self.session.put, 'PUT', resource, body, **query_params)
|
|
183
199
|
|
|
184
|
-
def delete(self, resource, **
|
|
200
|
+
def delete(self, resource, body=None, **query_params):
|
|
185
201
|
"""
|
|
186
202
|
Generic TeleSign REST API DELETE handler.
|
|
187
203
|
|
|
188
204
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
189
|
-
:param
|
|
205
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
206
|
+
:param query_params: query_params to perform the DELETE request with, as a dictionary.
|
|
190
207
|
:return: The RestClient Response object.
|
|
191
208
|
"""
|
|
192
|
-
return self._execute(self.session.delete, 'DELETE', resource, **
|
|
209
|
+
return self._execute(self.session.delete, 'DELETE', resource, body, **query_params)
|
|
193
210
|
|
|
194
|
-
def _execute(self, method_function, method_name, resource, **
|
|
211
|
+
def _execute(self, method_function, method_name, resource, body=None, **query_params):
|
|
195
212
|
"""
|
|
196
213
|
Generic TeleSign REST API request handler.
|
|
197
214
|
|
|
198
215
|
:param method_function: The Requests HTTP request function to perform the request.
|
|
199
216
|
:param method_name: The HTTP method name, as an upper case string.
|
|
200
217
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
201
|
-
:param
|
|
218
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
219
|
+
:param query_params: query_params to perform the HTTP request with, as a dictionary.
|
|
202
220
|
:return: The RestClient Response object.
|
|
203
221
|
"""
|
|
204
222
|
resource_uri = "{api_host}{resource}".format(api_host=self.api_host, resource=resource)
|
|
205
223
|
|
|
206
|
-
url_encoded_fields = self._encode_params(
|
|
224
|
+
url_encoded_fields = self._encode_params(query_params)
|
|
225
|
+
if body:
|
|
226
|
+
content_type = "application/json"
|
|
227
|
+
else:
|
|
228
|
+
content_type = None # set later
|
|
207
229
|
|
|
208
230
|
headers = RestClient.generate_telesign_headers(self.customer_id,
|
|
209
231
|
self.api_key,
|
|
210
232
|
method_name,
|
|
211
233
|
resource,
|
|
212
234
|
url_encoded_fields,
|
|
213
|
-
user_agent=self.user_agent
|
|
235
|
+
user_agent=self.user_agent,
|
|
236
|
+
content_type=content_type,
|
|
237
|
+
auth_method=self.auth_method)
|
|
214
238
|
|
|
215
239
|
if method_name in ['POST', 'PUT']:
|
|
216
|
-
payload = {
|
|
240
|
+
payload = {}
|
|
241
|
+
if body:
|
|
242
|
+
payload['json'] = body
|
|
243
|
+
if query_params:
|
|
244
|
+
payload['data'] = url_encoded_fields
|
|
217
245
|
else:
|
|
218
246
|
payload = {'params': url_encoded_fields}
|
|
219
247
|
|
|
@@ -4,6 +4,7 @@ from hmac import HMAC
|
|
|
4
4
|
from base64 import b64decode, b64encode
|
|
5
5
|
from hashlib import sha256
|
|
6
6
|
from random import SystemRandom
|
|
7
|
+
from enum import Enum
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def to_utc_rfc3339(a_datetime):
|
|
@@ -40,3 +41,8 @@ def verify_telesign_callback_signature(api_key, signature, json_str):
|
|
|
40
41
|
signatures_equal = False
|
|
41
42
|
|
|
42
43
|
return signatures_equal
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class AuthMethod(Enum):
|
|
47
|
+
BASIC = "Basic"
|
|
48
|
+
HMAC_SHA256 = "HMAC-SHA256"
|
|
@@ -0,0 +1,115 @@
|
|
|
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/>`_.
|
|
@@ -4,6 +4,7 @@ README.rst
|
|
|
4
4
|
setup.cfg
|
|
5
5
|
setup.py
|
|
6
6
|
examples/appverify/1_get_status_by_external_id.py
|
|
7
|
+
examples/intelligence/1_get_risk_score_and_related_insights.py
|
|
7
8
|
examples/messaging/1_send_message.py
|
|
8
9
|
examples/messaging/2_send_message_with_verification_code.py
|
|
9
10
|
examples/phoneid/1_check_phone_type_to_block_voip.py
|
|
@@ -14,6 +15,7 @@ examples/voice/2_send_voice_call_with_verification_code.py
|
|
|
14
15
|
examples/voice/3_send_voice_call_french.py
|
|
15
16
|
telesign/__init__.py
|
|
16
17
|
telesign/appverify.py
|
|
18
|
+
telesign/intelligence.py
|
|
17
19
|
telesign/messaging.py
|
|
18
20
|
telesign/phoneid.py
|
|
19
21
|
telesign/rest.py
|
|
@@ -6,6 +6,7 @@ from unittest import TestCase
|
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
8
|
from telesign.rest import RestClient
|
|
9
|
+
from telesign.util import AuthMethod
|
|
9
10
|
|
|
10
11
|
if sys.version_info < (3, 3):
|
|
11
12
|
from mock import Mock, patch
|
|
@@ -104,6 +105,29 @@ class TestRest(TestCase):
|
|
|
104
105
|
|
|
105
106
|
self.assertEqual(expected_authorization_header, actual_headers['Authorization'])
|
|
106
107
|
|
|
108
|
+
def test_generate_telesign_headers_with_post_basic_authentication(self):
|
|
109
|
+
method_name = 'POST'
|
|
110
|
+
date_rfc2616 = 'Wed, 14 Dec 2016 18:20:12 GMT'
|
|
111
|
+
nonce = 'A1592C6F-E384-4CDB-BC42-C3AB970369E9'
|
|
112
|
+
resource = '/v1/resource'
|
|
113
|
+
|
|
114
|
+
expected_authorization_header = ('Basic RkZGRkZGRkYtRUVFRS1ERERELTEyMzQtQUIxMjM'
|
|
115
|
+
'0NTY3ODkwOkVYQU1QTEUtLS0tVEU4c1RnZzQ1eXVzdW1vTjZCWXNCVmto'
|
|
116
|
+
'K3lSSjVjemdzbkNlaFphT1lsZFBKZG1GaDZOZVg4a3VuWjJ6VTFZV2FV'
|
|
117
|
+
'dy8wd1Y2eGZ3PT0=')
|
|
118
|
+
|
|
119
|
+
actual_headers = RestClient.generate_telesign_headers(self.customer_id,
|
|
120
|
+
self.api_key,
|
|
121
|
+
method_name,
|
|
122
|
+
resource,
|
|
123
|
+
'',
|
|
124
|
+
date_rfc2616=date_rfc2616,
|
|
125
|
+
nonce=nonce,
|
|
126
|
+
user_agent='unit_test',
|
|
127
|
+
auth_method=AuthMethod.BASIC.value)
|
|
128
|
+
|
|
129
|
+
self.assertEqual(expected_authorization_header, actual_headers['Authorization'])
|
|
130
|
+
|
|
107
131
|
def test_generate_telesign_headers_default_date_and_nonce(self):
|
|
108
132
|
method_name = 'GET'
|
|
109
133
|
resource = '/v1/resource'
|
|
@@ -144,6 +168,28 @@ class TestRest(TestCase):
|
|
|
144
168
|
self.assertEqual(post_kwargs, expected_post_kwargs,
|
|
145
169
|
"client.session.post.call_args kwargs do not match expected")
|
|
146
170
|
|
|
171
|
+
@patch('telesign.rest.RestClient.generate_telesign_headers', return_value={})
|
|
172
|
+
def test_post_body(self, mock_generate_telesign_headers):
|
|
173
|
+
test_host = 'https://test.com'
|
|
174
|
+
test_resource = '/test/resource'
|
|
175
|
+
test_params = {'test': '123_\u03ff_test'}
|
|
176
|
+
|
|
177
|
+
client = RestClient(self.customer_id, self.api_key, rest_endpoint=test_host)
|
|
178
|
+
client.session.post = Mock()
|
|
179
|
+
|
|
180
|
+
expected_post_args = (u'https://test.com/test/resource',)
|
|
181
|
+
expected_post_kwargs = {'headers': {}, 'json': test_params, 'timeout': client.timeout}
|
|
182
|
+
|
|
183
|
+
client.post(test_resource, body=test_params)
|
|
184
|
+
|
|
185
|
+
self.assertEqual(client.session.post.call_count, 1, "client.session.post not called")
|
|
186
|
+
|
|
187
|
+
post_args, post_kwargs = client.session.post.call_args
|
|
188
|
+
self.assertEqual(post_args, expected_post_args,
|
|
189
|
+
"client.session.post.call_args args do not match expected")
|
|
190
|
+
self.assertEqual(post_kwargs, expected_post_kwargs,
|
|
191
|
+
"client.session.post.call_args kwargs do not match expected")
|
|
192
|
+
|
|
147
193
|
@patch('telesign.rest.RestClient.generate_telesign_headers', return_value={})
|
|
148
194
|
def test_get(self, mock_generate_telesign_headers):
|
|
149
195
|
test_host = 'https://test.com'
|
|
@@ -209,3 +255,25 @@ class TestRest(TestCase):
|
|
|
209
255
|
"client.session.delete.call_args args do not match expected")
|
|
210
256
|
self.assertEqual(delete_kwargs, expected_delete_kwargs,
|
|
211
257
|
"client.session.delete.call_args kwargs do not match expected")
|
|
258
|
+
|
|
259
|
+
@patch('telesign.rest.RestClient.generate_telesign_headers', return_value={})
|
|
260
|
+
def test_post_basic_auth(self, mock_generate_telesign_headers):
|
|
261
|
+
test_host = 'https://test.com'
|
|
262
|
+
test_resource = '/test/resource'
|
|
263
|
+
test_params = {'test': '123_\u03ff_test'}
|
|
264
|
+
|
|
265
|
+
client = RestClient(self.customer_id, self.api_key, rest_endpoint=test_host, auth_method=AuthMethod.BASIC.value)
|
|
266
|
+
client.session.post = Mock()
|
|
267
|
+
|
|
268
|
+
expected_post_args = (u'https://test.com/test/resource',)
|
|
269
|
+
expected_post_kwargs = {'headers': {}, 'data': 'test=123_%CF%BF_test', 'timeout': client.timeout}
|
|
270
|
+
|
|
271
|
+
client.post(test_resource, **test_params)
|
|
272
|
+
|
|
273
|
+
self.assertEqual(client.session.post.call_count, 1, "client.session.post not called")
|
|
274
|
+
|
|
275
|
+
post_args, post_kwargs = client.session.post.call_args
|
|
276
|
+
self.assertEqual(post_args, expected_post_args,
|
|
277
|
+
"client.session.post.call_args args do not match expected")
|
|
278
|
+
self.assertEqual(post_kwargs, expected_post_kwargs,
|
|
279
|
+
"client.session.post.call_args kwargs do not match expected")
|
telesign-2.2.2/PKG-INFO
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: telesign
|
|
3
|
-
Version: 2.2.2
|
|
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://developer.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 Developer Center <https://developer.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 Developer Center <https://developer.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
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: telesign
|
|
3
|
-
Version: 2.2.2
|
|
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://developer.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 Developer Center <https://developer.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 Developer Center <https://developer.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{telesign-2.2.2 → telesign-2.2.3}/examples/messaging/2_send_message_with_verification_code.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{telesign-2.2.2 → telesign-2.2.3}/examples/voice/2_send_voice_call_with_verification_code.py
RENAMED
|
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
|
|
File without changes
|