Back to browse
GitHub Repository

A simple Python wrapper for reading data from Discourse forums

4 starsPython

Discourse-reader – a typed, read-only Python client for Discourse

by aleximb·Apr 17, 2026·1 point·0 comments

AI Analysis

MidNiche GemCozy

No API key needed for public data, but pydiscourse already exists.

Strengths
  • Typed Pydantic models with extra='allow' for plugin-specific fields.
  • Lazy iterators fetch posts in batches instead of loading entire topics upfront.
  • Automatic 429 retry with Retry-After header handling built in.
Weaknesses
  • Read-only client limits use cases — can't post, vote, or interact with forums.
  • Niche audience: only matters if you're pulling Discourse data in Python specifically.
Target Audience

Python developers scraping or analyzing Discourse forum data

Similar To

pydiscourse · discourse2

Post Description

Hi HN,

I've had to pull data from Discourse forums a few times now, and always had to keep dealing with raw requests.get(), rate-limiting and navigating the returned JSON. Our ecosystem is in Python so I looked if there was already a solution, I found pydiscourse (https://github.com/pydiscourse/pydiscourse), but it requires setting up an API key (a hassle) and only returns raw dicts.

There were good solutions in other languages (like discourse2 in TypeScript) but yeah that wasn't in Python.

This is useful if you don't want to set up an API key, only care about retrieving data (not interacting with the platform) and want something in Python. Also has some basic rate-limiting built in!

Example usage:

from discourse_reader import DiscourseClient client = DiscourseClient("https://meta.discourse.org") topic = client.topics.get(12345) print(topic.posts) print(topic.accepted_answer.cooked)

for topic in client.topics.latest(limit=100): print(f"{topic.views:>6} views {topic.title}")

The Pydantic models are set with extra="allow", so if you use this to hit forums with plugins that have extra fields those won't be dropped.

Similar Projects