|
2 | 2 |
|
3 | 3 | # codebeat:disable[TOO_MANY_FUNCTIONS] |
4 | 4 |
|
5 | | -import json |
6 | 5 |
|
7 | 6 | from .api_endpoints import ROUTE_HOST, EXPORTER |
8 | 7 | from .api_endpoints import ADDRESS_HOST, GET_ACTIVITIES_HOST, DUPLICATE_ROUTE, SHARE_ROUTE_HOST |
@@ -177,10 +176,9 @@ def insert_address_into_route_optimal_position(self, **kwargs): |
177 | 176 | 'optimal_position']): |
178 | 177 | params = {'api_key': self.params['api_key'], |
179 | 178 | 'route_id': kwargs.pop('route_id')} |
180 | | - data = json.dumps(kwargs, ensure_ascii=False) |
181 | 179 | response = self.api._request_put(ROUTE_HOST, |
182 | 180 | params, |
183 | | - data=data) |
| 181 | + json=kwargs) |
184 | 182 | return response.json() |
185 | 183 | else: |
186 | 184 | raise ParamValueException('params', 'Params are not complete') |
@@ -254,9 +252,8 @@ def resequence_route(self, **kwargs): |
254 | 252 | 'route_id': kwargs.pop('route_id'), |
255 | 253 | 'route_destination_id': kwargs.pop('route_destination_id'), |
256 | 254 | } |
257 | | - data = json.dumps(kwargs, ensure_ascii=False) |
258 | 255 | response = self.api._request_put(ROUTE_HOST, |
259 | | - params, data=data) |
| 256 | + params, json=kwargs) |
260 | 257 | return response.json() |
261 | 258 |
|
262 | 259 | else: |
@@ -289,10 +286,9 @@ def merge_routes(self, **kwargs): |
289 | 286 | AttributeError if there is an error deleting a route |
290 | 287 | """ |
291 | 288 | if self.check_required_params(kwargs, ['route_ids']): |
292 | | - data = json.dumps(kwargs, ensure_ascii=False) |
293 | 289 | response = self.api._request_post(MERGE_ROUTES_HOST, |
294 | 290 | self.params, |
295 | | - data=data) |
| 291 | + json=kwargs) |
296 | 292 | return response.json() |
297 | 293 |
|
298 | 294 | else: |
@@ -330,9 +326,8 @@ def update_route_destination_custom_data(self, **kwargs): |
330 | 326 | 'route_id': kwargs.pop('route_id'), |
331 | 327 | 'route_destination_id': kwargs.pop('route_destination_id'), |
332 | 328 | } |
333 | | - data = json.dumps(kwargs, ensure_ascii=False) |
334 | 329 | response = self.api._request_put(ADDRESS_HOST, |
335 | | - params, data=data) |
| 330 | + params, json=kwargs) |
336 | 331 | return response.json() |
337 | 332 |
|
338 | 333 | else: |
|
0 commit comments