Skip to main content

Streamlit Cookies Manager

Access and change browser cookies from Streamlit scripts:

import os
import streamlit as st
from streamlit_cookies_manager import EncryptedCookieManager

# This should be on top of your script
cookies = EncryptedCookieManager(
    # This prefix will get added to all your cookie names.
    # This way you can run your app on Streamlit Cloud without cookie name clashes with other apps.
    prefix="ktosiek/streamlit-cookies-manager/",
    # You should really setup a long COOKIES_PASSWORD secret if you're running on Streamlit Cloud.
    password=os.environ.get("COOKIES_PASSWORD", "My secret password"),
)
if not cookies.ready():
    # Wait for the component to load and send us current cookies.
    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  # This will get saved on next rerun
    if st.button("No really, change it now"):
        cookies.save()  # Force saving the cookies now, without a rerun

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_cookies_manager_hotpatched-0.2.1.tar.gz (676.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file streamlit_cookies_manager_hotpatched-0.2.1.tar.gz.

File metadata

File hashes

Hashes for streamlit_cookies_manager_hotpatched-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0af09d8c6fbb81d292c3b200d04b3f06e9c7339f282adbe6e84f3b036ddabb50
MD5 889a83e0fae2ae5b625eba90dd11d365
BLAKE2b-256 58f1e8720c442b7edd11e1f46aeff599a2415d335536ece5c3db7a373f8a7871

See more details on using hashes here.

File details

Details for the file streamlit_cookies_manager_hotpatched-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_cookies_manager_hotpatched-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a354206ece0a7b93a24d62c16109d636f407506ba5eecdde759307da18aeb47
MD5 45fccb733c19615cc572ba769588b3d3
BLAKE2b-256 27f723b612f86e8a1bd2106339e3375e44c798b0f5636ef2eba21c7078a35623

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page