1616
1717class 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