telesign 2.2.7__py2.py3-none-any.whl → 2.3.0__py2.py3-none-any.whl
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/rest.py +24 -12
- {telesign-2.2.7.dist-info → telesign-2.3.0.dist-info}/METADATA +1 -1
- {telesign-2.2.7.dist-info → telesign-2.3.0.dist-info}/RECORD +6 -6
- {telesign-2.2.7.dist-info → telesign-2.3.0.dist-info}/LICENSE.txt +0 -0
- {telesign-2.2.7.dist-info → telesign-2.3.0.dist-info}/WHEEL +0 -0
- {telesign-2.2.7.dist-info → telesign-2.3.0.dist-info}/top_level.txt +0 -0
telesign/rest.py
CHANGED
|
@@ -16,8 +16,8 @@ from telesign.util import AuthMethod
|
|
|
16
16
|
|
|
17
17
|
class RestClient(requests.models.RequestEncodingMixin):
|
|
18
18
|
"""
|
|
19
|
-
The
|
|
20
|
-
|
|
19
|
+
The Telesign RestClient is a generic HTTP REST client that can be extended to make requests against any of
|
|
20
|
+
Telesign's REST API endpoints.
|
|
21
21
|
|
|
22
22
|
RequestEncodingMixin offers the function _encode_params for url encoding the body for use in string_to_sign outside
|
|
23
23
|
of a regular HTTP request.
|
|
@@ -54,7 +54,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
54
54
|
timeout=10,
|
|
55
55
|
auth_method=None):
|
|
56
56
|
"""
|
|
57
|
-
|
|
57
|
+
Telesign RestClient useful for making generic RESTful requests against our API.
|
|
58
58
|
|
|
59
59
|
:param customer_id: Your customer_id string associated with your account.
|
|
60
60
|
:param api_key: Your api_key string associated with your account.
|
|
@@ -99,17 +99,17 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
99
99
|
content_type=None,
|
|
100
100
|
auth_method=None):
|
|
101
101
|
"""
|
|
102
|
-
Generates the
|
|
102
|
+
Generates the Telesign REST API headers used to authenticate requests.
|
|
103
103
|
|
|
104
104
|
Creates the canonicalized string_to_sign and generates the HMAC signature. This is used to authenticate requests
|
|
105
|
-
against the
|
|
105
|
+
against the Telesign REST API.
|
|
106
106
|
|
|
107
107
|
See https://developer.telesign.com/docs/authentication for detailed API documentation.
|
|
108
108
|
|
|
109
109
|
:param customer_id: Your account customer_id.
|
|
110
110
|
:param api_key: Your account api_key.
|
|
111
111
|
:param method_name: The HTTP method name of the request as a upper case string, should be one of 'POST', 'GET',
|
|
112
|
-
'PUT' or 'DELETE'.
|
|
112
|
+
'PUT', 'PATCH' or 'DELETE'.
|
|
113
113
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
114
114
|
:param url_encoded_fields: HTTP body parameters to perform the HTTP request with, must be a urlencoded string.
|
|
115
115
|
:param date_rfc2616: The date and time of the request formatted in rfc 2616, as a string.
|
|
@@ -117,7 +117,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
117
117
|
:param user_agent: (optional) User Agent associated with the request, as a string.
|
|
118
118
|
:param content_type: (optional) ContentType of the request, as a string.
|
|
119
119
|
:param auth_method: (optional) Authentication type ex: Basic, HMAC etc
|
|
120
|
-
:return: The
|
|
120
|
+
:return: The Telesign authentication headers.
|
|
121
121
|
"""
|
|
122
122
|
if date_rfc2616 is None:
|
|
123
123
|
date_rfc2616 = formatdate(usegmt=True)
|
|
@@ -177,7 +177,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
177
177
|
|
|
178
178
|
def post(self, resource, body=None, json_fields=None, **query_params):
|
|
179
179
|
"""
|
|
180
|
-
Generic
|
|
180
|
+
Generic Telesign REST API POST handler.
|
|
181
181
|
|
|
182
182
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
183
183
|
:param body: (optional) A dictionary sent as a part of request body.
|
|
@@ -188,7 +188,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
188
188
|
|
|
189
189
|
def get(self, resource, body=None, json_fields=None, **query_params):
|
|
190
190
|
"""
|
|
191
|
-
Generic
|
|
191
|
+
Generic Telesign REST API GET handler.
|
|
192
192
|
|
|
193
193
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
194
194
|
:param body: (optional) A dictionary sent as a part of request body.
|
|
@@ -199,7 +199,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
199
199
|
|
|
200
200
|
def put(self, resource, body=None, json_fields=None, **query_params):
|
|
201
201
|
"""
|
|
202
|
-
Generic
|
|
202
|
+
Generic Telesign REST API PUT handler.
|
|
203
203
|
|
|
204
204
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
205
205
|
:param body: (optional) A dictionary sent as a part of request body.
|
|
@@ -213,7 +213,7 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
213
213
|
|
|
214
214
|
def delete(self, resource, body=None, json_fields=None, **query_params):
|
|
215
215
|
"""
|
|
216
|
-
Generic
|
|
216
|
+
Generic Telesign REST API DELETE handler.
|
|
217
217
|
|
|
218
218
|
:param resource: The partial resource URI to perform the request against, as a string.
|
|
219
219
|
:param body: (optional) A dictionary sent as a part of request body.
|
|
@@ -221,10 +221,22 @@ class RestClient(requests.models.RequestEncodingMixin):
|
|
|
221
221
|
:return: The RestClient Response object.
|
|
222
222
|
"""
|
|
223
223
|
return self._execute(self.session.delete, 'DELETE', resource, body, json_fields, **query_params)
|
|
224
|
+
|
|
225
|
+
def patch(self, resource, body=None, json_fields=None, **query_params):
|
|
226
|
+
"""
|
|
227
|
+
Generic Telesign REST API PATCH handler.
|
|
228
|
+
|
|
229
|
+
:param resource: The partial resource URI to perform the request against, as a string.
|
|
230
|
+
:param body: (optional) A dictionary sent as a part of request body.
|
|
231
|
+
:param json_fields: (optional) A dictionary sent as a JSON body.
|
|
232
|
+
:param query_params: query_params to perform the PATCH request with, as a dictionary.
|
|
233
|
+
:return: The RestClient Response object.
|
|
234
|
+
"""
|
|
235
|
+
return self._execute(self.session.patch, 'PATCH', resource, body, json_fields, **query_params)
|
|
224
236
|
|
|
225
237
|
def _execute(self, method_function, method_name, resource, body=None, json_fields=None, **query_params):
|
|
226
238
|
"""
|
|
227
|
-
Generic
|
|
239
|
+
Generic Telesign REST API request handler.
|
|
228
240
|
|
|
229
241
|
:param method_function: The Requests HTTP request function to perform the request.
|
|
230
242
|
:param method_name: The HTTP method name, as an upper case string.
|
|
@@ -3,12 +3,12 @@ telesign/appverify.py,sha256=wBeaeUxGmYcZkrbxkkXlG3-0oZr5sVvegzVpdvaoO2A,1195
|
|
|
3
3
|
telesign/intelligence.py,sha256=t-xwlgxkXw1OMupF5K4_UKWeTArOr9XPvddmqgZftPI,1452
|
|
4
4
|
telesign/messaging.py,sha256=v7l-eKUPqz7Nrwka0YNPMkC2TaoFUvQm3yp_djuTPu0,1367
|
|
5
5
|
telesign/phoneid.py,sha256=mk03NxL3wlaXpd8b-BB6q_SKfCxbtuTO19ayAHxmzz0,954
|
|
6
|
-
telesign/rest.py,sha256=
|
|
6
|
+
telesign/rest.py,sha256=26EESKSPzSPIAf3VpVmCEPE8HSpAZRfGw5koIHsJeh8,12653
|
|
7
7
|
telesign/score.py,sha256=Kceu6IrirN9SsuT1geEWs0QHAn6H9ZNFyIDVHcBJdwg,908
|
|
8
8
|
telesign/util.py,sha256=stDxpL5ZQeGskE_OSGP04UFHs3ZP2ACaRpW1WyQGMHg,1624
|
|
9
9
|
telesign/voice.py,sha256=DJaWyQpun-T7LfNjpxpsUjupiv2ShW1jqoFQA-CE2-Y,1341
|
|
10
|
-
telesign-2.
|
|
11
|
-
telesign-2.
|
|
12
|
-
telesign-2.
|
|
13
|
-
telesign-2.
|
|
14
|
-
telesign-2.
|
|
10
|
+
telesign-2.3.0.dist-info/LICENSE.txt,sha256=a--xZ4PCKUL5rpct8RrUC6ODU_8ZKIU51kJPfsA4HUs,1058
|
|
11
|
+
telesign-2.3.0.dist-info/METADATA,sha256=7pxOUYH6cvpiHfYp7v0GFYN9Wgz3ZWqahdN3qHfm__g,4532
|
|
12
|
+
telesign-2.3.0.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
|
|
13
|
+
telesign-2.3.0.dist-info/top_level.txt,sha256=6LG7Jcr1jnpVhOWaIShoTdwYJn0QCfPhfudyVJNz1qg,9
|
|
14
|
+
telesign-2.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|