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

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.2
File Size Uploaded Provenance
masks_client-0.3.2.tar.gz 162.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 226.5 kB

Release files / masks_client-0.3.2.tar.gz

Download URL masks_client-0.3.2.tar.gz
Size 162.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16338e83a9723e23fa6f4216347b22b8f536e911c069dcb751e37cbb05f87424
BLAKE2b-256 checksum
How to use checksums
9a3645f6928aea055b52f55cfc4995ad84421413d3b63ca01e4aedf81889b40a
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 20, 2026.

Transparency log

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

Download URL masks_client-0.3.2-py3-none-any.whl
Size 64.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
241d5ae60d27d245c07b72d29fecf3150dd87d477cee855da635880b4d78df77
BLAKE2b-256 checksum
How to use checksums
48f1063e491be2bc5b08bcb04f0f9711745505bcdcf6509cdce6796ac09e7112
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 20, 2026.

Transparency log

Security for masks-client 0.3.2

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.2.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 20, 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