Skip to main content

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, and SameSite.
  • 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

mas_cookie_manager-0.1.2.tar.gz (115.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mas_cookie_manager-0.1.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page