We can use generic version of dict: Dict, to declare the dictionary type in python:

from typing import Dict


def get_request(self) -> Dict[str, str]:
    ...


def validate(request: Dict[str, str]) -> bool:
    ...

However this is deprecated since version 3.9. We can use directly dict:



def get_request(self) -> dict[str, str]:
    ...


def validate(request: dict[str, str]) -> bool:
    ...

For more info: Dict

All done!