Registry / http-networking / asyncpraw

asyncpraw

JSON →
library7.8.1pypypi✓ verified 83d ago

Async PRAW (asyncpraw) is the asynchronous Python Reddit API Wrapper, allowing for non-blocking interactions with Reddit's API. Current version is 7.8.1, with a release cadence following PRAW's major releases. It requires Python ~=3.8 and supports both OAuth2 and read-only modes.

pip install asyncpraw
INSTALL
IMPORT
SIG · ASYNCPRAW
A
asyncpraw
http-networkingpythonv7.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Reddit
from asyncpraw import Reddit
import asyncpraw

Minimal async example: create a Reddit instance using environment variables for credentials and fetch a subreddit.

import asyncpraw import os async def main(): reddit = asyncpraw.Reddit( client_id=os.environ.get('REDDIT_CLIENT_ID', ''), client_secret=os.environ.get('REDDIT_CLIENT_SECRET', ''), user_agent='asyncpraw:quickstart:v1.0 (by /u/your_username)', username=os.environ.get('REDDIT_USERNAME', ''), password=os.environ.get('REDDIT_PASSWORD', '') ) subreddit = await reddit.subreddit('learnpython', fetch=True) print(f'Subreddit display name: {subreddit.display_name}') if __name__ == '__main__': import asyncio asyncio.run(main())
Debug
Known issues
breakingasyncpraw 7.0+ changed the API for many methods to be coroutines. For example, `subreddit.submit()` and `comment.reply()` are now async. Old synchronous calls will fail with TypeError: 'coroutine' object is not subscriptable.
fix
Ensure all API calls that return a coroutine are awaited. Use `await subreddit.submit(...)` and `await comment.reply(...)`.
affects: >=7.0.0
deprecatedThe `reddit.read_only` attribute to check if the instance is read-only is deprecated in asyncpraw 7.4+. Use `reddit.reader_mode` instead.
fix
Replace `reddit.read_only` with `reddit.reader_mode`.
affects: >=7.4.0
gotchaExplicit `fetch=True` is required when retrieving lazy-loaded objects like Subreddit or Redditor in asyncpraw 7.0+. Otherwise, the object may be empty or raise AttributeError.
fix
Always pass `fetch=True` when calling `reddit.subreddit('subname', fetch=True)` or `reddit.redditor('username', fetch=True)`.
affects: >=7.0.0
gotchaAsyncpraw does not support Python >=3.13 due to asyncio changes. May raise `RuntimeError: Event loop changed` on Windows or Python 3.13+.
fix
Use Python 3.8 to 3.12. Monitor asyncpraw GitHub for 3.13 support.
affects: <=7.8.1
Upgrade
Version history
7.8.1latest on PyPI · released Dec 21, 2024
Audit
Dependencies
aiohttprequiredAsync HTTP client for API requests
prawcorerequiredLow-level Reddit API communication library
update_checkeroptionalChecks for library updates
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
1
Resources
asyncpraw — pip install asyncpraw · libregistry