# 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": "",
"name": "streamlit-cookies-manager-hotpatched",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Tomasz Kontusz",
"author_email": "tomasz.kontusz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/58/f1/e8720c442b7edd11e1f46aeff599a2415d335536ece5c3db7a373f8a7871/streamlit_cookies_manager_hotpatched-0.2.1.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\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Access and save cookies from Streamlit",
"version": "0.2.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "27f723b612f86e8a1bd2106339e3375e44c798b0f5636ef2eba21c7078a35623",
"md5": "45fccb733c19615cc572ba769588b3d3",
"sha256": "9a354206ece0a7b93a24d62c16109d636f407506ba5eecdde759307da18aeb47"
},
"downloads": -1,
"filename": "streamlit_cookies_manager_hotpatched-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "45fccb733c19615cc572ba769588b3d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 688267,
"upload_time": "2023-10-23T11:30:41",
"upload_time_iso_8601": "2023-10-23T11:30:41.616553Z",
"url": "https://files.pythonhosted.org/packages/27/f7/23b612f86e8a1bd2106339e3375e44c798b0f5636ef2eba21c7078a35623/streamlit_cookies_manager_hotpatched-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58f1e8720c442b7edd11e1f46aeff599a2415d335536ece5c3db7a373f8a7871",
"md5": "889a83e0fae2ae5b625eba90dd11d365",
"sha256": "0af09d8c6fbb81d292c3b200d04b3f06e9c7339f282adbe6e84f3b036ddabb50"
},
"downloads": -1,
"filename": "streamlit_cookies_manager_hotpatched-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "889a83e0fae2ae5b625eba90dd11d365",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 676439,
"upload_time": "2023-10-23T11:30:47",
"upload_time_iso_8601": "2023-10-23T11:30:47.721356Z",
"url": "https://files.pythonhosted.org/packages/58/f1/e8720c442b7edd11e1f46aeff599a2415d335536ece5c3db7a373f8a7871/streamlit_cookies_manager_hotpatched-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-23 11:30:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "streamlit-cookies-manager-hotpatched"
}