
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
A Python session management library with support for session timeouts, password-protected sessions, and persistent storage to files or databases. Suitable for web, GUI, and console applications. Provides functionality to create, update, delete, and validate sessions, with optional security and expiration controls. Ideal for managing user sessions in various types of Python projects.
Certainly! Below is a more detailed and comprehensive README.md
for your PySessionManager library, which includes sections like installation, usage, features, and more.
PySessionManager is an extensible session management library for Python, designed to work seamlessly with both command-line interface (CLI) and web applications. It provides an easy-to-use interface for managing sessions, including session creation, expiration (TTL), and optional password protection.
You can install PySessionManager via pip:
pip install pysessionmanager
Here is a simple usage example of how to create and manage sessions using PySessionManager:
from pysessionmanager import SessionManager
# Initialize the SessionManager
sm = SessionManager()
# Add a session for a user
session_id = sm.add_session("user123")
# Print the session ID and its status
print("Session started with ID:", session_id)
# Check if the session is active
if sm.is_active(session_id):
print(f"Session {session_id} is active.")
else:
print(f"Session {session_id} has expired.")
You can add a session for a user with the add_session()
method:
session_id = sm.add_session("user123", duration_seconds=3600)
This will create a session with a 1-hour expiration (TTL).
To check whether a session is still active, you can use is_active()
:
if sm.is_active(session_id):
print(f"Session {session_id} is active.")
Sessions automatically expire based on the time-to-live (TTL) you set when creating the session. You can also manually remove a session with the remove_session()
method:
sm.remove_session(session_id)
You can protect sessions with a password. This prevents unauthorized access to session data. To enable protection, pass a password when creating the session:
session_id = sm.add_session("user123", protected=True, password="securepassword")
To unlock a protected session, use the unlock_session()
method:
sm.unlock_session("user123", password="securepassword")
For security reasons, passwords are hashed before being stored. The library uses SHA-256 hashing to ensure that the password is not stored in plaintext.
PySessionManager can be customized to fit your application’s needs. Here are some options:
duration_seconds
parameter.Contributions are welcome! If you have a feature request, bug report, or want to contribute code, feel free to open an issue or submit a pull request.
PySessionManager is released under the MIT License.
FAQs
A Python session management library with support for session timeouts, password-protected sessions, and persistent storage to files or databases. Suitable for web, GUI, and console applications. Provides functionality to create, update, delete, and validate sessions, with optional security and expiration controls. Ideal for managing user sessions in various types of Python projects.
We found that pysessionmanager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.