@@ -254,7 +254,7 @@ def __init__(self,
254
254
self .host = host
255
255
self ._local = local ()
256
256
self ._client : Optional [BotocoreBaseClientPrivate ] = None
257
- self ._convert_to_request_dict_kwargs : Dict [ str , Any ] = {}
257
+ self ._convert_to_request_dict__endpoint_url = False
258
258
if region :
259
259
self .region = region
260
260
else :
@@ -358,11 +358,28 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
358
358
2. It provides a place to monkey patch HTTP requests for unit testing
359
359
"""
360
360
operation_model = self .client ._service_model .operation_model (operation_name )
361
- request_dict = self .client ._convert_to_request_dict (
362
- operation_kwargs ,
363
- operation_model ,
364
- ** self ._convert_to_request_dict_kwargs ,
365
- )
361
+ if self ._convert_to_request_dict__endpoint_url :
362
+ request_context = {
363
+ 'client_region' : self .region ,
364
+ 'client_config' : self .client .meta .config ,
365
+ 'has_streaming_input' : operation_model .has_streaming_input ,
366
+ 'auth_type' : operation_model .auth_type ,
367
+ }
368
+ endpoint_url , additional_headers = self .client ._resolve_endpoint_ruleset (
369
+ operation_model , operation_kwargs , request_context
370
+ )
371
+ request_dict = self .client ._convert_to_request_dict (
372
+ api_params = operation_kwargs ,
373
+ operation_model = operation_model ,
374
+ endpoint_url = endpoint_url ,
375
+ context = request_context ,
376
+ headers = additional_headers ,
377
+ )
378
+ else :
379
+ request_dict = self .client ._convert_to_request_dict (
380
+ operation_kwargs ,
381
+ operation_model ,
382
+ )
366
383
367
384
for i in range (0 , self ._max_retry_attempts_exception + 1 ):
368
385
attempt_number = i + 1
@@ -536,11 +553,10 @@ def client(self) -> BotocoreBaseClientPrivate:
536
553
parameter_validation = False , # Disable unnecessary validation for performance
537
554
connect_timeout = self ._connect_timeout_seconds ,
538
555
read_timeout = self ._read_timeout_seconds ,
539
- max_pool_connections = self ._max_pool_connections )
556
+ max_pool_connections = self ._max_pool_connections ,
557
+ )
540
558
self ._client = cast (BotocoreBaseClientPrivate , self .session .create_client (SERVICE_NAME , self .region , endpoint_url = self .host , config = config ))
541
- self ._convert_to_request_dict_kwargs = {}
542
- if 'endpoint_url' in inspect .signature (self ._client ._convert_to_request_dict ).parameters :
543
- self ._convert_to_request_dict_kwargs ['endpoint_url' ] = self .host
559
+ self ._convert_to_request_dict__endpoint_url = 'endpoint_url' in inspect .signature (self ._client ._convert_to_request_dict ).parameters
544
560
return self ._client
545
561
546
562
def get_meta_table (self , table_name : str , refresh : bool = False ):
0 commit comments