MAS Cookie Manager for Streamlit
Project description
MAS Cookie Manager
MAS Cookie Manager is a lightweight and reliable Streamlit component for managing client-side cookies easily.
Why MAS Cookie Manager?
Streamlit is a powerful framework for building interactive apps, but it lacks built-in support for client-side cookies.
MAS Cookie Manager solves this gap by offering a simple, efficient, and production-ready solution for cookie handling inside Streamlit apps.
Features
- Set cookies with expiration support.
- Get cookies without manual parsing.
- Remove cookies easily.
- Fully client-side, no backend needed.
- Designed to integrate seamlessly with Streamlit workflows.
Installation
pip install mas-cookie-manager
Usage Example
import streamlit as st
from mas_cookie_manager import cookie_manager
st.title("MAS Cookie Manager Demo")
if st.button("Set Cookie"):
cookie_manager(action="set", name="user_id", value="hello123", days=7)
if st.button("Get Cookie"):
user_id = cookie_manager(action="get", name="user_id")
if user_id:
st.write(f"Cookie value: {user_id}")
if st.button("Remove Cookie"):
cookie_manager(action="remove", name="user_id")
How It Works
MAS Cookie Manager uses a lightweight JavaScript Streamlit component to access and control browser cookies directly through document.cookie.
There are no server-side dependencies, making it simple and fast.
Roadmap
Version 2.0 is under active development.
Upcoming features will include:
- Built-in hashing support for cookie values (e.g., SHA-256, SHA-512).
- Encryption options for sensitive cookie data.
- Extended cookie attributes like
Secure,HttpOnly, andSameSite. - Cookie namespacing for better organization.
Hashing functionality will be a key focus in the next release to improve the security of cookie handling.
License
This project is licensed under the MIT License.
Author
Developed by Erdem Elmas
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters