Skip to content

Commit 0acc3ad

Browse files
Pull request #9: feature/EOA-2074-update-functionality
Merge in SDK/python_telesign from feature/EOA-2074-update-functionality to developer * commit 'e7a16da2cb1aa5d737de4b0f1ae0c3b0b5a72d12': update comment revert back the name TeleSignSDK updated comments Added patch method to rest.py for update functionality
2 parents f88fd6c + e7a16da commit 0acc3ad

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

RELEASE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.3.0
2+
- Added PATCH method to the RestClient class to facilitate Update Verification Process action
3+
14
2.2.7
25
- Added tracking to requests
36

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
here = path.abspath(path.dirname(__file__))
1313

14-
version = "2.2.7"
14+
version = "2.3.0"
1515

1616
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
1717
long_description = f.read()

telesign/rest.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
class RestClient(requests.models.RequestEncodingMixin):
1818
"""
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.
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.
2121
2222
RequestEncodingMixin offers the function _encode_params for url encoding the body for use in string_to_sign outside
2323
of a regular HTTP request.
@@ -54,7 +54,7 @@ def __init__(self,
5454
timeout=10,
5555
auth_method=None):
5656
"""
57-
TeleSign RestClient useful for making generic RESTful requests against our API.
57+
Telesign RestClient useful for making generic RESTful requests against our API.
5858
5959
:param customer_id: Your customer_id string associated with your account.
6060
:param api_key: Your api_key string associated with your account.
@@ -99,25 +99,25 @@ def generate_telesign_headers(customer_id,
9999
content_type=None,
100100
auth_method=None):
101101
"""
102-
Generates the TeleSign REST API headers used to authenticate requests.
102+
Generates the Telesign REST API headers used to authenticate requests.
103103
104104
Creates the canonicalized string_to_sign and generates the HMAC signature. This is used to authenticate requests
105-
against the TeleSign REST API.
105+
against the Telesign REST API.
106106
107107
See https://developer.telesign.com/docs/authentication for detailed API documentation.
108108
109109
:param customer_id: Your account customer_id.
110110
:param api_key: Your account api_key.
111111
: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'.
113113
:param resource: The partial resource URI to perform the request against, as a string.
114114
:param url_encoded_fields: HTTP body parameters to perform the HTTP request with, must be a urlencoded string.
115115
:param date_rfc2616: The date and time of the request formatted in rfc 2616, as a string.
116116
:param nonce: A unique cryptographic nonce for the request, as a string.
117117
:param user_agent: (optional) User Agent associated with the request, as a string.
118118
:param content_type: (optional) ContentType of the request, as a string.
119119
:param auth_method: (optional) Authentication type ex: Basic, HMAC etc
120-
:return: The TeleSign authentication headers.
120+
:return: The Telesign authentication headers.
121121
"""
122122
if date_rfc2616 is None:
123123
date_rfc2616 = formatdate(usegmt=True)
@@ -177,7 +177,7 @@ def generate_telesign_headers(customer_id,
177177

178178
def post(self, resource, body=None, json_fields=None, **query_params):
179179
"""
180-
Generic TeleSign REST API POST handler.
180+
Generic Telesign REST API POST handler.
181181
182182
:param resource: The partial resource URI to perform the request against, as a string.
183183
:param body: (optional) A dictionary sent as a part of request body.
@@ -188,7 +188,7 @@ def post(self, resource, body=None, json_fields=None, **query_params):
188188

189189
def get(self, resource, body=None, json_fields=None, **query_params):
190190
"""
191-
Generic TeleSign REST API GET handler.
191+
Generic Telesign REST API GET handler.
192192
193193
:param resource: The partial resource URI to perform the request against, as a string.
194194
:param body: (optional) A dictionary sent as a part of request body.
@@ -199,7 +199,7 @@ def get(self, resource, body=None, json_fields=None, **query_params):
199199

200200
def put(self, resource, body=None, json_fields=None, **query_params):
201201
"""
202-
Generic TeleSign REST API PUT handler.
202+
Generic Telesign REST API PUT handler.
203203
204204
:param resource: The partial resource URI to perform the request against, as a string.
205205
:param body: (optional) A dictionary sent as a part of request body.
@@ -213,18 +213,30 @@ def set_endpoint(self, rest_endpoint):
213213

214214
def delete(self, resource, body=None, json_fields=None, **query_params):
215215
"""
216-
Generic TeleSign REST API DELETE handler.
216+
Generic Telesign REST API DELETE handler.
217217
218218
:param resource: The partial resource URI to perform the request against, as a string.
219219
:param body: (optional) A dictionary sent as a part of request body.
220220
:param query_params: query_params to perform the DELETE request with, as a dictionary.
221221
:return: The RestClient Response object.
222222
"""
223223
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)
224236

225237
def _execute(self, method_function, method_name, resource, body=None, json_fields=None, **query_params):
226238
"""
227-
Generic TeleSign REST API request handler.
239+
Generic Telesign REST API request handler.
228240
229241
:param method_function: The Requests HTTP request function to perform the request.
230242
:param method_name: The HTTP method name, as an upper case string.

0 commit comments

Comments
 (0)