# Streamlit Cookies Manager
Access and change browser cookies from Streamlit scripts:
```python
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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "gitarplater-streamlit-cookies-manager",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Tomasz Kontusz",
"author_email": "tomasz.kontusz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2f/61/039142eccb1c72b01002270116fbbd540b86ceddd00c0585a275f9d92881/gitarplater_streamlit_cookies_manager-0.2.0.tar.gz",
"platform": null,
"description": "# Streamlit Cookies Manager\n\nAccess and change browser cookies from Streamlit scripts:\n\n```python\nimport os\nimport streamlit as st\nfrom streamlit_cookies_manager import EncryptedCookieManager\n\n# This should be on top of your script\ncookies = EncryptedCookieManager(\n # This prefix will get added to all your cookie names.\n # This way you can run your app on Streamlit Cloud without cookie name clashes with other apps.\n prefix=\"ktosiek/streamlit-cookies-manager/\",\n # You should really setup a long COOKIES_PASSWORD secret if you're running on Streamlit Cloud.\n password=os.environ.get(\"COOKIES_PASSWORD\", \"My secret password\"),\n)\nif not cookies.ready():\n # Wait for the component to load and send us current cookies.\n st.stop()\n\nst.write(\"Current cookies:\", cookies)\nvalue = st.text_input(\"New value for a cookie\")\nif st.button(\"Change the cookie\"):\n cookies['a-cookie'] = value # This will get saved on next rerun\n if st.button(\"No really, change it now\"):\n cookies.save() # Force saving the cookies now, without a rerun\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Access and save cookies from Streamlit",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "251c2c535cfabe7550be4910f1bfc4f2891f92967600e228667acc7c9b942c47",
"md5": "055253d19914e0653922b2338309ae44",
"sha256": "976d348293c7405be9a3d96f9fcb347598d33abae95613127b437a7e2a4e472f"
},
"downloads": -1,
"filename": "gitarplater_streamlit_cookies_manager-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "055253d19914e0653922b2338309ae44",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 348832,
"upload_time": "2024-10-10T11:38:19",
"upload_time_iso_8601": "2024-10-10T11:38:19.357739Z",
"url": "https://files.pythonhosted.org/packages/25/1c/2c535cfabe7550be4910f1bfc4f2891f92967600e228667acc7c9b942c47/gitarplater_streamlit_cookies_manager-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2f61039142eccb1c72b01002270116fbbd540b86ceddd00c0585a275f9d92881",
"md5": "eefd6056c5417a034724404b976a15a2",
"sha256": "3d5c04a434dc5658ee0bcac9acaa4d3054afbdbd00bc46f0ae9af7bb932863dd"
},
"downloads": -1,
"filename": "gitarplater_streamlit_cookies_manager-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "eefd6056c5417a034724404b976a15a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 342794,
"upload_time": "2024-10-10T11:38:21",
"upload_time_iso_8601": "2024-10-10T11:38:21.556261Z",
"url": "https://files.pythonhosted.org/packages/2f/61/039142eccb1c72b01002270116fbbd540b86ceddd00c0585a275f9d92881/gitarplater_streamlit_cookies_manager-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 11:38:21",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "gitarplater-streamlit-cookies-manager"
}