Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: _convert_to_request_dict() missing 1 required positional argument 'endpoint_url'

We have a python code which installs the latest version of libraries(boto3 etc) and the code gets executed Until the boto3 version update 1.24.96 the code was working as expected , but the later version which was released on 25/10/2022 the code is throwing error at code which calls the _convert_to_request_dict() using boto3 with the following error TypeError: _convert_to_request_dict() missing 1 required positional argument 'endpoint_url' After further analysis found the difference in the method definition of _convert_to_request_dict() in client.py class in the older and new versions of botocore

The old version definition is as follows(botocore 1.27.96)

def _convert_to_request_dict(
    self, api_params, operation_model, context=None
):

If we observe the method signature it takes four arguments and it does not contain the attribute endpoint_url

**The Latest version definition is as follows(botocore 1.28.3 ) **

def _convert_to_request_dict(
    self,
    api_params,
    operation_model,
    endpoint_url,
    context=None,
    headers=None,
    set_user_agent_header=True,
):

If we observe from the recent method signature , it takes 7 arguments and it contains endpoint_url as parameter and is mandatory to add when calling the same method Hence understood the cause of the issue, so as a quick fix we have defined the older boto3 version and it works But in the long run this could not solve the issue ,Could someone help us on how to mock the method parameter with values such as None or null which adds no difference but helps us from running into the issue

like image 958
Lavanya Alla Avatar asked May 30 '26 17:05

Lavanya Alla


1 Answers

Per a comment on the OP, updating to the latest pynamodb version fixed this for us. It pulls in https://github.com/pynamodb/PynamoDB/pull/1083. Version 5.4.1 at time of writing.

This may not be exactly the solve to OP's problem, but it was certainly the solve we were looking for.

like image 77
lynn Avatar answered Jun 01 '26 07:06

lynn