Skip to content

Generate param tuple

async_boto.utils.generate_param_tuple

generate_param_tuple

generate_param_tuple(params)

To support MultiValueQueryParameters these cant be given using a dict. We convert these dict to a list of key value pairs and let aiohttp and botocore handle the rest.

Source code in async_boto/utils/generate_param_tuple.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def generate_param_tuple(params: dict[str, Any]) -> list[tuple]:
    """
    To support MultiValueQueryParameters these cant be given using a dict.
    We convert these dict to a list of key value pairs and let aiohttp and
    botocore handle the rest.

    """
    new_params = []
    for key, value in params.items():
        if isinstance(value, list):
            for value_ in value:
                new_params.append((key, value_))
        elif isinstance(value, bool):
            new_params.append((key, str(value)))
        else:
            new_params.append((key, value))
    return sorted(new_params)