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

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.3
File Size Uploaded Provenance
masks_client-0.3.3.tar.gz 162.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 226.7 kB

Release files / masks_client-0.3.3.tar.gz

Download URL masks_client-0.3.3.tar.gz
Size 162.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8761878abccf499a866ba25a00b1ab36f3a2b5852260160107f7b69136f30426
BLAKE2b-256 checksum
How to use checksums
a3453feb08adf777fef1a4e4872efdc9f3da3b055d20ae19c5928d97c039f338
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 22, 2026.

Transparency log

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

Download URL masks_client-0.3.3-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d5f20e9c34877459727c34c6abd1ef6d37fbe16170cef1bb9db69ab5c5c18fc
BLAKE2b-256 checksum
How to use checksums
ea58dab8b430935cb39c964df9cb9b2c48f53d139f7cb7af7e1ea716a2e17417
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 22, 2026.

Transparency log

Security for masks-client 0.3.3

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.3.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 22, 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