Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions spond/spond.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, username: str, password: str) -> None:
self.groups: list[JSONDict] | None = None
self.events: list[JSONDict] | None = None
self.messages: list[JSONDict] | None = None
self.profile: JSONDict | None = None

async def _login_chat(self) -> None:
api_chat_url = f"{self.api_url}chat"
Expand All @@ -34,6 +35,22 @@ async def _login_chat(self) -> None:
self._chat_url = result["url"]
self._auth = result["auth"]

@_SpondBase.require_authentication
async def get_profile(self) -> JSONDict:
"""
Retrieves all information connected to the user's account, subject to authenticated user's access.

Returns
-------
JSONDict
information connected to the user's account

"""
url = f"{self._API_BASE_URL}profile"
async with self.clientsession.get(url, headers=self.auth_headers) as r:
self.profile = await r.json()
return self.profile

@_SpondBase.require_authentication
async def get_groups(self) -> list[JSONDict] | None:
"""
Expand Down
Loading