api.utils module¶
Module with utils for the Eonvelope api api.
- api.utils.query_param_list_to_typed_list(query_param_list, parse_type=<class 'str'>)[source]¶
Helper function to parse a query_param list as returned by
django.utils.datastructures.MultiValueDict.getlist()into a typed list.This validates the parameters and allows to support the comma-separated query_param format.
- Parameters:
- Return type:
list[TypeAliasType]- Returns:
The parsed query parameters in a list of given type.
- Raises:
ValueError – If one of the parameters cannot be parsed to the given type.
- api.utils.csv_query_param_to_typed_list(query_param, parse_type=<class 'str'>)[source]¶
Helper function to parse a query_param in csv format into a typed list.
A string without , also qualifies as csv and is valid input.
- Parameters:
query_param (
str) – The query parameter to parse.parse_type (
TypeAliasType) – The type to parse the values to.
- Return type:
list[TypeAliasType]- Returns:
The parsed query parameters in a list of given type.
- Raises:
ValueError – If one of the parameters in the csv cannot be parsed to the given type.