(20241127) GMail work updated.

This commit is contained in:
2024-11-27 20:13:25 +05:30
parent 7b08e37d2f
commit 269e36ec27
11 changed files with 532 additions and 1 deletions
+110
View File
@@ -0,0 +1,110 @@
"""
AUTHOR:
Khushal P Soonderji
DATE:
Tuesday, 12th Nov., 2024
OBJECTIVE:
To get the session information from the session token for a given user.
REFERENCES:
N/A
DOWNLOADS:
N/A
"""
# *****************************************************************************************************************
# ***** ****
# *** IMPORT ***
# ***** ****
# *****************************************************************************************************************
# To make sibling directories accessible for imports:
import sys
sys.path.append(".")
sys.path.append("..")
# To use Quart:
from quart import current_app
# The data models:
from models.data.user import (
IsSessionRequest
)
# *****************************************************************************************************************
# ***** ****
# *** MACROS / ONE-TIME INIT ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** VARIABLES ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** CLASSES ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** FUNCTIONS ***
# ***** ****
# *****************************************************************************************************************
async def get_session(session_token):
"""
Gets the session's info from the session token.
:param session_token: The identifier of the session.
:return: The info or None.
"""
session_info = await current_app.user.is_session(
db_conn = current_app.sql_reader,
request = IsSessionRequest(sessionToken = session_token),
cache = current_app.module_cache,
)
if isinstance(session_info, dict): return session_info.get("data")
else: return None
# *****************************************************************************************************************
# ***** ****
# *** MAIN PROGRAM ***
# ***** ****
# *****************************************************************************************************************
if __name__ == "__main__":
pass