tremolo-login
tremolo-login is basically an extension of tremolo-session.
You can use it just like tremolo-session but with additional methods like login(), logout(), and is_logged_in().
Installation
python3 -m pip install --upgrade tremolo_login
Usage
#!/usr/bin/env python3
from hmac import compare_digest
from tremolo import Application
from tremolo_login import Session
app = Application()
# this is a session middleware
# that enables you to use request.ctx.session
Session(app, expires=1800)
@app.route('/')
async def index(request, **server):
session = request.ctx.session
if session is None or not session.is_logged_in():
return b'You are not logged in. <a href="/login">Login</a>.'
return b'Welcome to Dashboard. <a href="/logout">Logout</a>.'
@app.route('/login')
async def login(request, **server):
session = request.ctx.session
if request.method == b'POST':
form_data = await request.form()
if ('password' in form_data and
compare_digest(form_data['password'][0], 'mypass')):
# password match! set current session as logged in:
session.login()
# the return value is a `token`, if you want to use
# `Authorization: sess <token>`
return b'Login success! Go to <a href="/">Dashboard</a>.'
return (b'<form action="/login" method="post"><div>'
b'<label for="password">Password:</label> '
b'<input type="text" name="password" placeholder="mypass" /> '
b'<input type="submit" value="Login" /></div>'
b'</form>')
@app.route('/logout')
async def logout(request, response, **server):
session = request.ctx.session
session.logout()
# if you want the session data to be deleted:
# the session id will also rotate on the next login
# session.delete()
response.set_status(302, b'Found')
response.set_header(b'Location', b'/')
return b''
if __name__ == '__main__':
app.run('0.0.0.0', 8000, debug=True, reload=True)
Testing
Just run python3 -m tests.
Or if you also want measurements with coverage:
coverage run -m tests
coverage combine
coverage report
coverage html # to generate html reports
License
MIT License
Metadata
Release files for tremolo-login 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tremolo_login-1.1.1.tar.gz | 5.5 kB | With provenance | Details for tremolo_login-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tremolo_login-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for tremolo_login-1.1.1-py3-none-any.whl |
Total release size: 11.1 kB
Release files / tremolo_login-1.1.1.tar.gz
| Download URL | tremolo_login-1.1.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a96fe8a73916fba76619104a1d403c683f4602daa89c829289dbade2edf0b72
|
|
BLAKE2b-256 checksum How to use checksums |
d73a8bf3ae747f57b4acace1112f656e40a1727cf8f9cfb1ff71897af568aa74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 1, 2026.
Transparency logRelease files / tremolo_login-1.1.1-py3-none-any.whl
| Download URL | tremolo_login-1.1.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cde92a7a695526c89541d0b16fd097bea3cf4e83835cbd6b36b5242ae87efb7
|
|
BLAKE2b-256 checksum How to use checksums |
af76669d8f2fd1d0849804a8a8f6e65fa74d195f1ea8801dd76c78399297cb22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 1, 2026.
Transparency logSecurity for tremolo-login 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tremolo_login-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.