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_tofield). - Attachments are base64-encoded as
{filename, content_type, content_base64}. - One
Idempotency-Keyis generated per send (24 h dedupe window).
License
MIT © Lockally
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lockally_fastapi-0.1.0.tar.gz.
File metadata
- Download URL: lockally_fastapi-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
656c8ae19d40c5dde2fc9dfa172820046c9abb6e1a07b938757dc45046b51555
|
|
| MD5 |
abc9e2b0d45d60076157818673a07112
|
|
| BLAKE2b-256 |
9d0d04d55331867f66791596ef7cc8c06da6054de4f14614bbdad3541b8bf904
|
Provenance
The following attestation bundles were made for lockally_fastapi-0.1.0.tar.gz:
Publisher:
publish.yml on LockallyInc/lockally-fastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lockally_fastapi-0.1.0.tar.gz -
Subject digest:
656c8ae19d40c5dde2fc9dfa172820046c9abb6e1a07b938757dc45046b51555 - Sigstore transparency entry: 2359380944
- Sigstore integration time:
-
Permalink:
LockallyInc/lockally-fastapi@97823b22de5b0a7bb33b18fb3947848011bda75f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LockallyInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@97823b22de5b0a7bb33b18fb3947848011bda75f -
Trigger Event:
push
-
Statement type:
File details
Details for the file lockally_fastapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lockally_fastapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3e3f67a663b5ee126f6bc3ea37d92f1f4f0de18f3e99e80d294efac4adab9b7
|
|
| MD5 |
a78fe4a28114c336e2538f2805da8224
|
|
| BLAKE2b-256 |
66b5407b3a94993b9e37f3c0add187ac2bc7bf6c68aa68f5b7ea2b2f42cb7c80
|
Provenance
The following attestation bundles were made for lockally_fastapi-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on LockallyInc/lockally-fastapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lockally_fastapi-0.1.0-py3-none-any.whl -
Subject digest:
f3e3f67a663b5ee126f6bc3ea37d92f1f4f0de18f3e99e80d294efac4adab9b7 - Sigstore transparency entry: 2359381129
- Sigstore integration time:
-
Permalink:
LockallyInc/lockally-fastapi@97823b22de5b0a7bb33b18fb3947848011bda75f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LockallyInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@97823b22de5b0a7bb33b18fb3947848011bda75f -
Trigger Event:
push
-
Statement type: