How to Get Reddit Data with Python (2026 Guide)
How to get Reddit data with Python in 2026: PRAW and Reddit's approval step, Pushshift's status, and working code for posts, comments and pandas.
Tarun Khatri
Published · Updated · 7 min read
To get Reddit data with Python, use PRAW with approved Reddit API credentials, or call a REST API with requests.
This guide is for you if you want posts, comments and threads in a DataFrame today. You get the honest state of the official route, then working code you can copy.
Paste this to see Reddit posts in your terminal:
import os
import requests
r = requests.post(
"https://api.weirapp.io/v1/reddit/search",
headers={"Authorization": f"Bearer {os.environ['WEIR_API_KEY']}"},
json={"query": "httpx OR niquests", "subreddit": "Python", "limit": 10},
)
for post in r.json()["data"]:
print(post["score"], post["title"])
- Pick a routePRAW with approved credentials, or a REST API key.
- Write one helperIt pages through any endpoint until the cursor runs out.
- Search, list, read threadsThree endpoints cover most Reddit research.
- Load into pandasThe items are flat dicts, so a DataFrame takes them as is.
Step 1: Know what changed with the Reddit API
Reddit API access now needs approval before you get credentials.
On 11 November 2025, Reddit announced its Responsible Builder Policy in r/redditdev. New apps must ask first. The policy says: "You must request access and get explicit approval before accessing any Reddit data through our API."
Existing access was not affected.
If you are approved, the free tier allows 100 queries per minute per OAuth client id, says Reddit's Data API Wiki. Commercial use needs Reddit's written approval. Our Reddit API pricing breakdown covers that side.
| Route | Status, October 2026 | What you need |
|---|---|---|
| Reddit API + PRAW | Works after approval | Client id, secret, user agent |
| Pushshift | Moderators only | A moderator account Reddit approves |
| Scraping reddit.com | A terms question | Your own legal advice |
| Weir REST API | Read-only, public data | An API key |
The fastest route depends on whether you already hold approved credentials.
Step 2: Use PRAW if you have approved credentials
PRAW, the Python Reddit API Wrapper, is the long-standing choice. It is actively maintained, with version 8.0.3 out in August 2026.
A read-only client needs three values, per its quick start:
import os
import praw
reddit = praw.Reddit(
client_id=os.environ["REDDIT_CLIENT_ID"],
client_secret=os.environ["REDDIT_CLIENT_SECRET"],
user_agent="python:my-research-script:v1.0 (by u/your_username)",
)
for s in reddit.subreddit("Python").search("httpx", sort="top", time_filter="year", limit=10):
print(s.id, s.score, s.title)
PRAW handles OAuth and Reddit's rate-limit headers for you.
Its weak point is not the code. It is getting the credentials, because the approval queue decides when you can start.
Pushshift won't fill the gap. Since June 2023 it has been live only for moderators, "limited to moderation use cases only." Scraping reddit.com yourself is a terms question: Reddit's policy says you "must not circumvent or exceed access limits". Ask a lawyer, not a blog post.
Step 3: Set up requests and a paging helper
The rest of this guide uses Weir's REST API. It reads public posts, comments and communities, and returns them in Reddit's own field names. Weir is our product, and it is not affiliated with Reddit.
Sign up with no card, create a key, then install two packages:
pip install requests pandas
export WEIR_API_KEY="weir_live_..."
Every list response carries meta.nextCursor. Send it back unchanged, and stop when it is null. Searches are POST with the cursor in the body; listings are GET with it in the query string.
Open a session once:
import os, time, requests
API = "https://api.weirapp.io"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['WEIR_API_KEY']}"
Then one helper covers both kinds of endpoint:
def pages(method, path, payload, max_pages=5):
cursor = None
for _ in range(max_pages):
args = {**payload, **({"cursor": cursor} if cursor else {})}
kw = {"params": args} if method == "GET" else {"json": args}
r = session.request(method, API + path, timeout=60, **kw)
if r.status_code == 429: # rate limited: wait as told, retry once
time.sleep(int(r.headers.get("Retry-After", "5")))
r = session.request(method, API + path, timeout=60, **kw)
r.raise_for_status() # a 402 means out of credits; retrying won't help
yield (page := r.json())
if not (cursor := page["meta"]["nextCursor"]):
return
Step 4: Search Reddit with Python
POST /v1/reddit/search takes Reddit's own search syntax in query. You can add subreddits (up to 25), sort and time:
body = {"query": "httpx OR niquests", "subreddits": ["Python", "learnpython"],
"sort": "top", "time": "year", "limit": 100}
posts = [p for page in pages("POST", "/v1/reddit/search", body, 3) for p in page["data"]]
We ran this search with limit: 3 on 19 October 2026. It cost 10 credits. One post, trimmed:
{
"id": "1sackyi",
"subreddit": "Python",
"title": "Niquests 3.18 — 3 Years of Innovations in HTTP",
"author": "Ousret",
"score": 480,
"numComments": 87,
"linkFlairText": "Showcase",
"createdAt": "2026-04-02T09:27:46.000Z"
}
One limit comes from Reddit itself. Its search covers post titles and bodies, not comment text.
To find words inside comments, read a community's comment stream with GET /v1/reddit/subreddits/{name}/comments.
Step 5: Read new posts and full comment threads
With no keyword, use the listing endpoint. sort=new is arrival order, and you can join communities with +:
new_posts = [p for page in pages("GET", "/v1/reddit/subreddits/Python+learnpython/posts",
{"sort": "new", "limit": 100}, 2) for p in page["data"]]
Reddit stops listings at about 1,000 posts. NSFW posts are left out unless you pass includeNsfw=true.
For a whole thread, GET /v1/reddit/posts/{id}/comments returns the tree flattened depth-first. The first page takes up to 500 comments and 10 reply levels. meta.moreCount estimates how many still sit behind Reddit's "load more" links.
comments = [c for page in pages("GET", "/v1/reddit/posts/1sackyi/comments",
{"limit": 500, "depth": 10, "sort": "top"}, 10) for c in page["data"]]
for c in comments[:5]:
print(" " * c["depth"] + f'{c["author"]} ({c["score"]}): {c["body"][:60]!r}')
Each comment carries depth and parentId, so you can rebuild the tree with a dictionary. Deleted authors come back as "[deleted]", and Reddit fuzzes scores, so treat them as approximate.
Step 6: Load Reddit data into a pandas DataFrame
The items are flat dictionaries, so pandas takes them directly:
import pandas as pd
df = pd.DataFrame(posts)[["id", "subreddit", "title", "score", "numComments", "createdAt"]]
df["createdAt"] = pd.to_datetime(df["createdAt"])
print(df.sort_values("score", ascending=False).head(10))
print(df.groupby("subreddit")["score"].agg(["count", "median"]))
pd.DataFrame(comments).to_csv("thread.csv", index=False)
What does Reddit data cost in Python?
You pay per result, not per request, and failed calls are free.
Each response's x-credits-charged header shows what that call cost. Packs start at $5 for 25,000 credits, on the pricing page.
Heavier endpoints count for more against the rate limit. A search counts as 2 requests and a comment tree as 4, which is why the helper honours Retry-After.
When to use PRAW instead
Weir is read-only and not licensed by Reddit, so access can change. Pick PRAW when:
- You already hold approved credentials. The official free tier is cheaper per item.
- You need to write. Posting, voting and moderating only work through Reddit.
- Your organisation needs a direct agreement with Reddit.
- Your use is sensitive. The Responsible Builder Policy bars inferring health or politics, and re-identifying users. Follow it whatever your source.
FAQ
Is the Reddit API free for Python?
For approved, non-commercial use, yes. You get 100 queries per minute per OAuth client id. Since November 2025 you must request access and wait for Reddit's approval. Commercial use needs Reddit's written approval at a price Reddit does not publish.
Does PRAW still work in 2026?
Yes. PRAW 8.0.3 shipped in August 2026 and works with any approved credentials. What changed is access: new apps now ask Reddit for approval before they get a client id and secret.
Can I still use Pushshift for Reddit history?
Only if you moderate a community. Since June 2023, Pushshift is limited to moderators that Reddit approves, for moderation use only. For other history, our Reddit API alternatives post lists the options.
Can I search Reddit comments with Python?
Not through Reddit's search, which covers post titles and bodies only. Read a community's comment stream instead, with GET /v1/reddit/subreddits/{name}/comments, and filter the text in your own code.
Sources
- Reddit, "Introducing the Responsible Builder Policy + new approval process for API access", r/redditdev (11 November 2025): https://www.reddit.com/r/redditdev/comments/1oug31u/introducing_the_responsible_builder_policy_new/
- Reddit Responsible Builder Policy (checked October 2026): https://support.reddithelp.com/hc/en-us/articles/42728983564564-Responsible-Builder-Policy
- Reddit Data API Wiki, rate limits (checked October 2026): https://support.reddithelp.com/hc/en-us/articles/16160319875092-Reddit-Data-API-Wiki
- Reddit Public Content Policy: https://support.reddithelp.com/hc/en-us/articles/26410290525844-Public-Content-Policy
- Pushshift, "Pushshift Live Again and How Moderators Can Request Pushshift Access" (June 2023): https://www.reddit.com/r/pushshift/comments/14ei799/pushshift_live_again_and_how_moderators_can/
- PRAW on PyPI (8.0.3, August 2026): https://pypi.org/project/praw/
- PRAW quick start: https://praw.readthedocs.io/en/stable/getting_started/quick_start.html
- Weir docs, pagination, billing and errors: https://docs.weirapp.io/pagination
- Weir search run on 19 October 2026 (limit 3, 10 credits)