Skip to content

resources

Monzo API 'whoami' resource.

WhoAmIResource dataclass

Bases: BaseResource

Monzo API 'whoami' resource.

Note

Monzo API docs: https://docs.monzo.com/#authenticating-requests

Source code in pymonzo/whoami/resources.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class WhoAmIResource(BaseResource):
    """Monzo API 'whoami' resource.

    Note:
        Monzo API docs: https://docs.monzo.com/#authenticating-requests
    """

    def whoami(self) -> MonzoWhoAmI:
        """Return information about the access token.

        Note:
            Monzo API docs: https://docs.monzo.com/#authenticating-requests

        Returns:
            Information about the access token.
        """
        endpoint = "/ping/whoami"
        response = self._get_response(method="get", endpoint=endpoint)

        who_am_i = MonzoWhoAmI(**response.json())

        return who_am_i

whoami()

Return information about the access token.

Note

Monzo API docs: https://docs.monzo.com/#authenticating-requests

Returns:

Type Description
MonzoWhoAmI

Information about the access token.

Source code in pymonzo/whoami/resources.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def whoami(self) -> MonzoWhoAmI:
    """Return information about the access token.

    Note:
        Monzo API docs: https://docs.monzo.com/#authenticating-requests

    Returns:
        Information about the access token.
    """
    endpoint = "/ping/whoami"
    response = self._get_response(method="get", endpoint=endpoint)

    who_am_i = MonzoWhoAmI(**response.json())

    return who_am_i