Skip to main content

Lockally for FastAPI

Official Lockally integration for FastAPI. Inject a Lockally client into any route with FastAPI's dependency system.

Install

pip install lockally-fastapi

Configure

Construct a provider and use it directly as a dependency:

from fastapi import Depends, FastAPI
from lockally_fastapi import Lockally, LockallyClient

app = FastAPI()
lockally = Lockally(api_key="lk_live_xxx")      # lk_test_xxx runs in sandbox
# lockally = Lockally(api_key="lk_live_xxx", base_url="https://api.lockally.com")

@app.post("/signup", status_code=202)
def signup(client: LockallyClient = Depends(lockally)):
    client.send_email(
        from_="alerts@yourdomain.com",
        to="user@example.com",
        subject="Welcome",
        html="<b>Thanks for signing up.</b>",
        reply_to="support@yourdomain.com",
    )

Prefer configuration from the environment? Set LOCKALLY_API_KEY (and optionally LOCKALLY_BASE_URL) and use the ready-made annotated dependency:

from lockally_fastapi import LockallyDep

@app.post("/signup", status_code=202)
def signup(client: LockallyDep):
    client.send_email(from_="alerts@yourdomain.com", to="user@example.com", subject="Hi")

to/cc/bcc/reply_to accept a single address or a list; attachments is a list of (filename, content, content_type) (content is bytes or str).

Mapping notes

  • Reply-To is sent as a header (Lockally has no reply_to field).
  • Attachments are base64-encoded as {filename, content_type, content_base64}.
  • One Idempotency-Key is generated per send (24 h dedupe window).

License

MIT © Lockally

Metadata

Release files for lockally-fastapi 0.1.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 lockally-fastapi 0.1.0
File Size Uploaded Provenance
lockally_fastapi-0.1.0.tar.gz 5.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lockally-fastapi 0.1.0
File Interpreter ABI Platform
lockally_fastapi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / lockally_fastapi-0.1.0.tar.gz

Download URL lockally_fastapi-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
656c8ae19d40c5dde2fc9dfa172820046c9abb6e1a07b938757dc45046b51555
BLAKE2b-256 checksum
How to use checksums
9d0d04d55331867f66791596ef7cc8c06da6054de4f14614bbdad3541b8bf904
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 Aug 6, 2026.

Transparency log

Release files / lockally_fastapi-0.1.0-py3-none-any.whl

Download URL lockally_fastapi-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3e3f67a663b5ee126f6bc3ea37d92f1f4f0de18f3e99e80d294efac4adab9b7
BLAKE2b-256 checksum
How to use checksums
66b5407b3a94993b9e37f3c0add187ac2bc7bf6c68aa68f5b7ea2b2f42cb7c80
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 Aug 6, 2026.

Transparency log

Security for lockally-fastapi 0.1.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 lockally_fastapi-0.1.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 Aug 6, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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