Skip to main content

llsd-asgi

llsd-asgi adds automatic LLSD content negotiation to ASGI applications (Starlette, FastAPI, Quart, etc.) with a single line of code:

app.add_middleware(LLSDMiddleware)

The code for llsd-asgi is based on msgpack-asgi, a similar middleware library for the MessagePack binary format.

Installation

Install with pip:

pip install llsd-asgi

Quickstart (FastAPI)

You can use llsd-asgi with FastAPI like so:

from fastapi import FastAPI
from llsd_asgi import LLSDMiddleware

app = FastAPI()
app.add_middleware(LLSDMiddleware)

Quickstart (Starlette)

As a lower level example using Starlette:

from llsd_asgi import LLSDMiddleware
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def homepage(request):
    return JSONResponse({"hello": "world"})


app = Starlette(debug=True, routes=[
    Route('/', homepage),
])

# Wrap your application with the LLSD middleware
app = LLSDMiddleware(app)

How it works

flowchart TD
    A(Client) <-->|LLSD| B(LLSDMiddleware)
    B <-->|JSON| C(App)

Your ASGI application is wrapped around the LLSDMiddleware, which performs content negotiation based on Content-Type and Accept HTTP headers.

Quirks mode

Passing quirks=True to the middleware enables 🤪 quirks mode. The behavior of this mode matches that of poorly behaved Linden Lab services, where the server returns LLSD even if the client has not requested it.

Metadata

Release files for llsd-asgi 0.2.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 llsd-asgi 0.2.2
File Size Uploaded Provenance
llsd-asgi-0.2.2.tar.gz 9.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llsd-asgi 0.2.2
File Interpreter ABI Platform
llsd_asgi-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / llsd-asgi-0.2.2.tar.gz

Download URL llsd-asgi-0.2.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
24ecbaefa22e3fb85ff1fbb99d35c5e53bc504553b2ad590d7ccbba4cbebd6ee
BLAKE2b-256 checksum
How to use checksums
2f73478988ce5f6f63ecfb0dfd9ad4c1f6513c4703e250322ae616f4b48893a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / llsd_asgi-0.2.2-py3-none-any.whl

Download URL llsd_asgi-0.2.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3eb346eaa32b60f4cf5a5244737c027f83c44c85ed475ba63964148a8f51f2
BLAKE2b-256 checksum
How to use checksums
558477a264fded7e29777b29910bf177b8eb7e48d8d9585ff9ee480159070594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Security for llsd-asgi 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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