Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

fedi-libs/apkit-litestar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

THIS PROJECT IS ABANDONED! USE apkit.ActivityPubServer OR OTHER PROJECT!

apkit-litestar is currently focused on developing apkit/apmodel/apsig, so there are no plans to rewrite it at this time.

apkit-litestar

☄ litestar integration for apkit

Installation

$ pip install apkit-litestar

Usage

Response

apkit-litestar can create responses that include models in apmodel format as content.

from apmodel import Note
from apkit_litestar import Response
from litestar import Litestar, get, Request

@get("/test")
def test(request: Request) -> Response:
  return Response(content=Note(
      content="test"
  ))

app = Litestar(
  route_handlers=[test]
)

Middleware

Can be used like the starlette integration that comes with regular apkit

from apkit import APKit
from apkit_litestar import ActivityPubMiddleware
from apmodel import Create
from litestar import Litestar, Request

ap = APKit(
    name="test",
    description="test",
)
app = Litestar(
  route_handlers=[],
  middleware=[
    ActivityPubMiddleware(apkit=ap)
  ]
)

@ap.on(Create)
async def on_create(request: Request, create: Create):
  ...

About

☄ litestar integration for apkit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages