Open aegeavaz-pfizer opened 2 years ago
Yes please, liked this library better then stx. only missing is delete functionality.
i have the same problem
# 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"),
)
if not cookies.ready():
# Wait for the component to load and send us current cookies.
st.spinner()
st.stop()
print(cookies.pop("session"))
cookies.__delitem__("session")
I tried both and it doesn't work. Any ideas how to fix this?
@Odrec You can try this:
# unset username in cookies
cookies['username'] = ""
and then:
if "username" in cookies.keys() and str(cookies['username']):
# my coockies has username
else:
# my coockies hasn't username
Hi ktosiek...
I'm testing your cookie manager, and looks good, but I'm not able to delete a cookie...
I have tried:
del cookies[name] cookies.delitem(name)
call save after this... and any combination works...
is there any way to delete an existing cookie?
Thank you very much.