Longwei Documentation¶
Welcome to the Longwei documentation. Longwei is a minimal async Python client for ActivityPub servers (Mastodon, Pleroma, GotoSocial). It is the library powering Fedinesia, Feed2Fedi, and FenLiu and Zhongli.
Quick start¶
import asyncio
import httpx
from longwei import APClient
async def main():
async with httpx.AsyncClient() as client:
ap = await APClient.create(
instance="mastodon.social",
client=client,
access_token="your_token",
)
status = await ap.post_status("Hello, fediverse!")
print(status.url)
asyncio.run(main())
Documentation Sections¶
- Getting Started — Installation, instantiation, and basic operations
- Authentication — Password grant and OAuth authorization code flow
- API Methods — Complete reference for all
APClientmethods - Posting — Statuses, media, scheduled posts, and content warnings
- Enums —
VisibilityandSearchType - Data Models —
Status,Account, and all nested Pydantic models - Error Handling — Exception hierarchy and handling patterns
- Upgrading — Migration guide for earlier versions