Skip to main content

masks for Python

masks-client connects a Python web app, service, or machine to a masks server. It signs people in to FastAPI, Django, and Flask apps, gets tokens for a service or machine, and checks access tokens in an API.

Install

It needs Python 3.10 or later and imports as masks.

pip install masks-client

A web app adds the extra for its framework: masks-client[fastapi], masks-client[django], or masks-client[flask].

Sign people in to a FastAPI app

import os
from typing import Annotated

from fastapi import Depends, FastAPI
from masks.fastapi import Actor, Config, Masks

auth = Masks(
    Config(
        issuer=os.environ["MASKS_ISSUER"],
        resource="https://app.example.com",
        name="Catalog",
        secret=os.environ["SESSION_SECRET"],
    )
)

app = FastAPI()
auth.install(app)


@app.get("/settings")
async def settings(actor: Annotated[Actor, Depends(auth.require())]):
    return {"name": actor.name}

To connect the app to masks:

  1. Set MASKS_ISSUER to your masks tenant.
  2. Start the app.
  3. Open /auth/handshake and approve the app in masks.

Documentation

  • Python apps explains the handshake, sessions, privileges, and checking tokens.
  • FastAPI, Django, and Flask set up each framework.
  • masks-client lists every setting and call, including machines, DPoP, and the device flow.

Metadata

Release files for masks-client 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for masks-client 0.3.1
File Size Uploaded Provenance
masks_client-0.3.1.tar.gz 161.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for masks-client 0.3.1
File Interpreter ABI Platform
masks_client-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 224.5 kB

Release files / masks_client-0.3.1.tar.gz

Download URL masks_client-0.3.1.tar.gz
Size 161.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fd2aba1d883300f72fe7fb1ff3d659baebf7daf38944d8f5f515e8de56b3f345
BLAKE2b-256 checksum
How to use checksums
56d32823ac8b4bc5b2c34a607595fb913b3815c0ca38a7d34d695ecf97c47964
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Release files / masks_client-0.3.1-py3-none-any.whl

Download URL masks_client-0.3.1-py3-none-any.whl
Size 63.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac52855f176ba356c228472d3def03c3edf0d15547efd61f0372e43d7543a15d
BLAKE2b-256 checksum
How to use checksums
24e10cca3412c017682b1bcf9df1e158fc41233c02c85c68b4b13323411ba7b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for masks-client 0.3.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for masks_client-0.3.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 Oct 19, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page