Unofficial Python client for the public JSON endpoints of lobste.rs.

  • Fully typed Pydantic models
  • Async-first API built on httpx
  • Automatic response parsing
  • Context-manager support

Features

  • Typed Models
    • resources are represented as Pydantic models with type annotations
  • async-first
    • the API is built via httpx.AsyncClient
  • Context Manager Support
    • supports usage via async with
  • built-in caching
    • responses are cached in-memory for a configurable duration
    • experimental

Supported Resources

  • Stories
  • Comments
  • Users
  • Tags
  • Hot feed
  • New feed
  • Tag feeds

Quick Example

import asyncio

from lobstr import Lobstr


async def main():
    async with Lobstr() as lob:
        story = await lob.story.get("109l2t")

        print(story.title)
        print(story.score)


asyncio.run(main())

Continue with the Installation guide.