Skip to content

Instantly share code, notes, and snippets.

View elhe26's full-sized avatar
❤️‍🔥
In the zone 🔥

Erick Heredia elhe26

❤️‍🔥
In the zone 🔥
View GitHub Profile
@tvst
tvst / session_id.py
Last active May 18, 2023 12:05
Hack to get a session-specific ID in Streamlit. See https://discuss.streamlit.io/t/session-specific-caching/271
import streamlit.ReportThread as ReportThread
from streamlit.server.Server import Server
def get_session_id():
# Hack to get the session object from Streamlit.
ctx = ReportThread.get_report_ctx()
this_session = None