in geocoding_lambda/lambda_function.py [0:0]
def validate_filter_countries_arg(arg: str) -> Tuple[bool, Optional[List[str]]]:
logger = logging.getLogger(__name__)
filter_countries_arg = None
try:
assert isinstance(arg, str) and len(arg.strip())
filter_countries_arg = json.loads(arg)
except (AssertionError, JSONDecodeError) as exc:
logger.debug(exc)
logger.error('Argument provided is not a JSON string.')
return False, None
try:
assert isinstance(filter_countries_arg, list) and len(filter_countries_arg) > 0
for country_arg in filter_countries_arg:
assert isinstance(country_arg, str) and len(country_arg.strip()) > 0
except AssertionError as exc:
logger.debug(exc)
logger.error('Argument provided is not a list of strings.')
return False, None
return True, filter_countries_arg