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

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.0
File Size Uploaded Provenance
masks_client-0.3.0.tar.gz 160.3 kB With provenance Details

Built distribution (wheel)

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

Total release size: 223.6 kB

Release files / masks_client-0.3.0.tar.gz

Download URL masks_client-0.3.0.tar.gz
Size 160.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a864f4b15ef1976d85e15896b288172d89c95699a75f5dbd273686be9c6f8cd8
BLAKE2b-256 checksum
How to use checksums
a760332175b677187d97a02d85c89b7ae73f9bb995309a79bede62eb9deac5b6
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 14, 2026.

Transparency log

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

Download URL masks_client-0.3.0-py3-none-any.whl
Size 63.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd2dd4e547d7b571c53d91bcf5099eee39cbf3a1d3beb3745b2ba44263b1234c
BLAKE2b-256 checksum
How to use checksums
44e04eea7c703b38ae5ea352f1422d750347a28b5e355dab55e9a63f0b7d6674
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 14, 2026.

Transparency log

Security for masks-client 0.3.0

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.0.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 14, 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