{"repo":"alex-oleshkevich/starsessions","free":true,"listed":false,"github":"https://github.com/alex-oleshkevich/starsessions","clone":"git clone https://github.com/alex-oleshkevich/starsessions.git","description":"Advanced sessions for Starlette and FastAPI frameworks","language":"Python","stars":123,"topics":["starlette","fastapi","session","asgi","python"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Starsessions Advanced sessions for Starlette and FastAPI frameworks Installation Install starsessions package: Use the redis extra for Redis support: Quick start See example applications in the examples/ directory: - fastapi app.py — FastAPI integration with autoloading - login.py — login/logout flow with session ID regeneration - rolling.py — rolling session expiration - redis .py — Redis-backed sessions with lifespan management Usage 1. Add SessionMiddleware to your application to enable session support. 2. Configure a session store and pass it to the middleware. 3. Load the session in your view by calling load session(connection) . Cookie security By default, the middleware uses strict defaults: the cookie lifetime is limited to the browser session and is only sent over HTTPS. You can relax these defaults via cookie https only , lifetime , and cookie same site : The example above allows sessions over HTTP and sets the lifetime to 14 days. The lifetime parameter also accepts datetime.timedelta : Loading session Session data is not loaded automatically. Call load session before accessing it. Accessing an unloaded session raises SessionNotLoaded : You can avoid calling load session manually by using SessionAutoloadMiddleware . Session autoload For performance reasons, the session is not autoloaded by default. Sometimes it is annoying to call load session too often. We provide SessionAutoloadMiddleware to reduce the boilerplate by autoloading the session for you. There are two","default_branch":null,"files":null,"tree":[],"storefront":"/r/alex-oleshkevich","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/alex-oleshkevich/starsessions/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}