Name | streamlit-cookies-manager JSON |
Version |
0.2.0
JSON |
| download |
home_page | |
Summary | Access and save cookies from Streamlit |
upload_time | 2021-12-25 13:42:42 |
maintainer | |
docs_url | None |
author | Tomasz Kontusz |
requires_python | >=3.9,<4.0 |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Tomasz Kontusz",
"author_email": "tomasz.kontusz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a8/15/d016f1b2e1c547fecf7782dac3860d2aad4e22b4c1664d78bb2a873163ef/streamlit-cookies-manager-0.2.0.tar.gz",
"platform": "",
"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": "6160d4aefff016f9fe48d10c59b2e52ae823444525f973e7948821c9eefb4217",
"md5": "3c87b333d821e94df5cb266f966dfa66",
"sha256": "12503dc3367dfc2a780cb9e4a81ad791737806a7b9d1c25a006386e32aabe956"
},
"downloads": -1,
"filename": "streamlit_cookies_manager-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c87b333d821e94df5cb266f966dfa66",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 690962,
"upload_time": "2021-12-25T13:42:46",
"upload_time_iso_8601": "2021-12-25T13:42:46.493012Z",
"url": "https://files.pythonhosted.org/packages/61/60/d4aefff016f9fe48d10c59b2e52ae823444525f973e7948821c9eefb4217/streamlit_cookies_manager-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a815d016f1b2e1c547fecf7782dac3860d2aad4e22b4c1664d78bb2a873163ef",
"md5": "c883cb43ecde0396809b316eb9dd1c30",
"sha256": "498531778bd4a63267364e8986b3774319d3ba2f4ba65a92357196723966e4d4"
},
"downloads": -1,
"filename": "streamlit-cookies-manager-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "c883cb43ecde0396809b316eb9dd1c30",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 680070,
"upload_time": "2021-12-25T13:42:42",
"upload_time_iso_8601": "2021-12-25T13:42:42.064075Z",
"url": "https://files.pythonhosted.org/packages/a8/15/d016f1b2e1c547fecf7782dac3860d2aad4e22b4c1664d78bb2a873163ef/streamlit-cookies-manager-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-12-25 13:42:42",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "streamlit-cookies-manager"
}