Streamlit Cookies Manager
Access and change browser cookies from Streamlit scripts:
import os
import streamlit as st
from streamlit_cookies_manager import EncryptedCookieManager
cookies = EncryptedCookieManager(
prefix="ktosiek/streamlit-cookies-manager/",
password=os.environ.get("COOKIES_PASSWORD", "My secret password"),
)
if not cookies.ready():
st.stop()
st.write("Current cookies:", cookies)
value = st.text_input("New value for a cookie")
if st.button("Change the cookie"):
cookies['a-cookie'] = value
if st.button("No really, change it now"):
cookies.save()