|
2 | 2 | TeleSign |
3 | 3 | ======== |
4 | 4 |
|
5 | | -**Information**: For more information, visit the `TeleSign website <http://www.TeleSign.com>`_ or the `TeleSign Developer Portal <https://developer.telesign.com/>`_. |
6 | | - |
7 | | -**Author**: Telesign Corp. |
8 | | - |
9 | | -TeleSign Web Services: Python SDK |
10 | | ---------------------------------- |
11 | | - |
12 | | -**TeleSign web services** conform to the `REST Web Service Design Model <http://en.wikipedia.org/wiki/Representational_state_transfer>`_. Services are exposed as URI-addressable resources through the set of *RESTful* procedures in our **TeleSign REST API**. |
13 | | - |
14 | | -The **TeleSign Python SDK** is a set of software development tools— a *Python Library* that wraps the TeleSign REST API, and it simplifies TeleSign application development in the `Python programming language <http://pypi.python.org/pypi/>`_. The SDK software is packaged as a Python module called **telesign.api**, and is distributed as a Python Software Package using the `Python Package Index (PyPI) <http://pypi.python.org/pypi/>`_. |
15 | | - |
16 | | -The Python Classes |
17 | | ------------------- |
18 | | - |
19 | | -With just three classes, **telesign.api** abstracts much of the complexity of the TeleSign REST API. |
20 | | - |
21 | | -+-------------------------+--------------------------------------------------------------------------+ |
22 | | -| Python Class | Description | |
23 | | -+=========================+==========================================================================+ |
24 | | -| telesign.api.PhoneId | The **PhoneId** class exposes five services that each provide | |
25 | | -| | information about a specified phone number. | |
26 | | -| | | |
27 | | -| | *standard* | |
28 | | -| | Retrieves the standard set of details about the specified phone | |
29 | | -| | number. This includes the type of phone (for example, land line | |
30 | | -| | or mobile), and its approximate geographic location. | |
31 | | -| | *score* | |
32 | | -| | Retrieves a score for the specified phone number. This ranks the | |
33 | | -| | phone number's "risk level" on a scale from 0 to 1000, so you can | |
34 | | -| | code your web application to handle particular use cases (for | |
35 | | -| | example, to stop things like chargebacks, identity theft, fraud, | |
36 | | -| | and spam). | |
37 | | -| | *contact* | |
38 | | -| | In addition to the information retrieved by *standard*, this service | |
39 | | -| | provides the name and address associated with the specified phone | |
40 | | -| | number. | |
41 | | -| | *live* | |
42 | | -| | In addition to the information retrieved by *standard*, this service | |
43 | | -| | provides actionable data associated with the specified phone number. | |
44 | | -| | *number_deactivation* | |
45 | | -| | In addition to the information retrieved by *standard*, this service | |
46 | | -| | provides information on number deactivation for the phone number | |
47 | | -| | provided. | |
48 | | -| | | |
49 | | -+-------------------------+--------------------------------------------------------------------------+ |
50 | | -| telesign.api.Verify | The **Verify** class exposes three services for sending users a | |
51 | | -| | verification token (a three to five-digit number). You can use this | |
52 | | -| | mechanism to test whether you can reach users at the phone number | |
53 | | -| | they supplied, or you can have them use the token to authenticate | |
54 | | -| | themselves with your web application. In addition, this class also | |
55 | | -| | exposes a service that allows you to confirm the result of the | |
56 | | -| | authentication. | |
57 | | -| | | |
58 | | -| | You can use this verification factor in combination with *username* | |
59 | | -| | and *password* to provide *two-factor* authentication for higher | |
60 | | -| | security. | |
61 | | -| | | |
62 | | -| | *call* | |
63 | | -| | Calls the specified phone number and uses speech synthesis to speak | |
64 | | -| | the verification code to the user. | |
65 | | -| | *sms* | |
66 | | -| | Sends a text message containing the verification code to the | |
67 | | -| | specified phone number (supported for mobile phones only). | |
68 | | -| | *smart* | |
69 | | -| | Smart intelligently determines the best service to use based on | |
70 | | -| | the end user device and then attempts to place a call, send an SMS, | |
71 | | -| | or send a push request. | |
72 | | -| | *push* | |
73 | | -| | Sends a push notification containing the verification code to the | |
74 | | -| | specified phone number (supported for registered devices only). | |
75 | | -| | *status* | |
76 | | -| | Retrieves the verification result. You make this call in your web | |
77 | | -| | application after users complete the authentication transaction | |
78 | | -| | (using either a *call* or *sms*). | |
79 | | -| | | |
80 | | -+-------------------------+--------------------------------------------------------------------------+ |
81 | | -| telesign.api.Telebureau | The **Telebureau** class exposes services for creating, retrieving, | |
82 | | -| | updating and deleting telebureau fraud events. You can use this | |
83 | | -| | mechanism to test whether you can reach Telebureau services. | |
84 | | -| | | |
85 | | -| | *create* | |
86 | | -| | Creates a Telebureau event corresponding to supplied data. | |
87 | | -| | *retrieve* | |
88 | | -| | Retrieves the fraud event status. You make this call in your web | |
89 | | -| | application after completion of create/update transaction for a | |
90 | | -| | Telebureau event. | |
91 | | -| | *delete* | |
92 | | -| | Deletes a previously submitted fraud event. You make this call in | |
93 | | -| | your web application after completion of submit/update transaction | |
94 | | -| | for a Telebureau event. | |
95 | | -| | | |
96 | | -+-------------------------+--------------------------------------------------------------------------+ |
| 5 | +TeleSign provides the world’s most comprehensive approach to account security for Web and mobile applications. |
| 6 | + |
| 7 | +For more information about TeleSign, visit the `TeleSign website <http://www.TeleSign.com>`_. |
| 8 | + |
| 9 | +TeleSign REST API: Python SDK |
| 10 | +----------------------------- |
| 11 | + |
| 12 | +**TeleSign web services** conform to the `REST Web Service Design Model |
| 13 | +<http://en.wikipedia.org/wiki/Representational_state_transfer>`_. Services are exposed as URI-addressable resources |
| 14 | +through the set of *RESTful* procedures in our **TeleSign REST API**. |
| 15 | + |
| 16 | +The **TeleSign Python SDK** is a set modules and functions — a *Python Library* that wraps the |
| 17 | +TeleSign REST API, and it simplifies TeleSign application development in the `Python programming language |
| 18 | +<http://pypi.python.org/pypi/>`_. The SDK software is distributed on |
| 19 | +`GitHub <https://github.com/TeleSign/python_telesign>`_ and also as a Python Software Package using the |
| 20 | +`Python Package Index (PyPI) <http://pypi.python.org/pypi/>`_. |
| 21 | + |
| 22 | +Documentation |
| 23 | +------------- |
| 24 | + |
| 25 | +Detailed documentation for TeleSign REST APIs is available in the `Developer Portal <https://developer.telesign.com/>`_. |
97 | 26 |
|
98 | 27 | Installation |
99 | 28 | ------------ |
100 | 29 |
|
101 | | -With `Easy |
102 | | -Install <http://peak.telecommunity.com/DevCenter/EasyInstall>`_ |
103 | | -installed, simply type **easy\_install telesign** at the command prompt. |
104 | | -Alternatively, you can download the project source, and execute **python |
105 | | -setup.py install**. |
| 30 | +To install the TeleSign Enterprise Python SDK: |
106 | 31 |
|
107 | | -Python Code Example: To Verify a Call |
108 | | -------------------------------------- |
| 32 | +.. code-block:: bash |
109 | 33 |
|
110 | | -Here's a basic code example. |
| 34 | + $ pip install -e ~/path/to/python_telesign_enterprise |
111 | 35 |
|
112 | | -:: |
| 36 | +Alternatively, you can execute **cd ~/path/to/python_telesign_enterprise && python setup.py install**. |
113 | 37 |
|
114 | | - >>> from telesign.api import Verify |
115 | | - >>> phone_number = "13103409700" |
116 | | - >>> cust_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890" |
117 | | - >>> secret_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==" |
118 | | - >>> verify = Verify(cust_id, secret_key) # Instantiate a Verify instance object, |
119 | | - >>> result = verify.call(phone_number, verify_code=1234) # and use it to call the "call" method. |
120 | | - >>> print result.data |
121 | | - |
122 | | - {u'status': {u'updated_on': u'2015-04-23T21:28:06.837153', u'code': 103, u'description': u'Call in progress'}, u'errors': [], u'verify': {u'code_state': u'UNKNOWN', u'code_entered': u''}, u'sub_resource': u'call', u'reference_id': u'DGFDF6E11AB86303ASDFD425BE00000657', u'resource_uri': u'/v1/verify/DGFDF6E11AB86303ASDFD425BE00000657'} |
| 38 | +Python Code Example: Verify SMS |
| 39 | +------------------------------- |
123 | 40 |
|
124 | | -For more examples, see the Documentation section below. |
| 41 | +Here's a basic code example with JSON response. |
125 | 42 |
|
126 | | -Authentication |
127 | | --------------- |
| 43 | +.. code-block:: python |
128 | 44 |
|
129 | | -You will need a Customer ID and API Key in order to use TeleSign’s REST API. If you are already a customer and need an API Key, you can generate one in `TelePortal <https://teleportal.telesign.com>`_. If you are not a customer and would like to get an API Key, please contact `support@telesign.com <mailto:support@telesign.com>`_. |
| 45 | + from __future__ import print_function |
| 46 | + from telesignenterprise.verify import VerifyClient |
130 | 47 |
|
131 | | -Documentation |
132 | | -------------- |
| 48 | + customer_id = "customer_id" |
| 49 | + secret_key = "secret_key" |
133 | 50 |
|
134 | | -You will need sphinx_ installed to generate the |
135 | | -documentation. Documentation can be generated by running **python |
136 | | -setup.py doc**. Generated documentation can be found in the |
137 | | -*doc/build/* directory. |
| 51 | + phone_number = "phone_number" |
138 | 52 |
|
139 | | -Detailed documentation for TeleSign™ REST APIs is available in the |
140 | | -`Developer Portal <https://developer.telesign.com/>`_. |
| 53 | + verify_client = VerifyClient(customer_id, secret_key) |
| 54 | + result = verify_client.sms(phone_number) |
141 | 55 |
|
142 | | -Testing |
143 | | -------- |
| 56 | + print(result.json) |
144 | 57 |
|
145 | | -The easiest way to run the tests is to install `nose 1.3.6 |
146 | | -<https://pypi.python.org/pypi/nose/1.3.6>`_ (**easy_install |
147 | | -nose**) and run **nosetests** or **python setup.py test** in the root |
148 | | -of the distribution. Tests are located in the *test/* directory. |
| 58 | +.. code-block:: javascript |
149 | 59 |
|
| 60 | + {'errors': [], |
| 61 | + 'reference_id': '25685A40218006049044A58789044948', |
| 62 | + 'resource_uri': '/v1/verify/25685A40218006049044A58789044948', |
| 63 | + 'status': {'code': 290, |
| 64 | + 'description': 'Message in progress', |
| 65 | + 'updated_on': '2017-02-07T03:13:42.610863Z'}, |
| 66 | + 'sub_resource': 'sms', |
| 67 | + 'verify': {'code_entered': '', 'code_state': 'UNKNOWN'}} |
150 | 68 |
|
151 | | -Support and Feedback |
152 | | --------------------- |
| 69 | +For more examples, see the examples folder or visit `TeleSign Developer Portal <https://developer.telesign.com/>`_. |
153 | 70 |
|
154 | | -For more information about the Phone Verify and PhoneID Standard services, please contact your TeleSign representative: |
| 71 | +Authentication |
| 72 | +-------------- |
155 | 73 |
|
156 | | -Email: `support@telesign.com <mailto:support@telesign.com>`_ |
| 74 | +You will need a Customer ID and API Key in order to use TeleSign’s REST API. If you are already a customer and need an |
| 75 | +API Key, you can generate one in `TelePortal <https://teleportal.telesign.com>`_. |
157 | 76 |
|
158 | | -Phone: +1 310 740 9700 |
| 77 | +Testing |
| 78 | +------- |
159 | 79 |
|
160 | | -.. _sphinx: http://sphinx.pocoo.org/ |
| 80 | +The easiest way to run the tests is to install `nose <https://pypi.python.org/pypi/nose>`_ (**pip install nose**) and |
| 81 | +run **nosetests** in the root of the distribution. Tests are located in the *test/* directory. |
0 commit comments