{"id":26740,"library":"asyncpraw","title":"Async PRAW","description":"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.","status":"active","version":"7.8.1","language":"python","source_language":"en","source_url":"https://github.com/praw-dev/asyncpraw","tags":["reddit","api","async","aiohttp","wrapper"],"install":[{"cmd":"pip install asyncpraw","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Async HTTP client for API requests","package":"aiohttp","optional":false},{"reason":"Low-level Reddit API communication library","package":"prawcore","optional":false},{"reason":"Checks for library updates","package":"update_checker","optional":true}],"imports":[{"note":"Reddit is a class inside the asyncpraw module, not a submodule. Direct import may fail due to circular imports.","wrong":"from asyncpraw import Reddit","symbol":"Reddit","correct":"import asyncpraw\nreddit = asyncpraw.Reddit(...)"}],"quickstart":{"code":"import asyncpraw\nimport os\n\nasync def main():\n    reddit = asyncpraw.Reddit(\n        client_id=os.environ.get('REDDIT_CLIENT_ID', ''),\n        client_secret=os.environ.get('REDDIT_CLIENT_SECRET', ''),\n        user_agent='asyncpraw:quickstart:v1.0 (by /u/your_username)',\n        username=os.environ.get('REDDIT_USERNAME', ''),\n        password=os.environ.get('REDDIT_PASSWORD', '')\n    )\n    subreddit = await reddit.subreddit('learnpython', fetch=True)\n    print(f'Subreddit display name: {subreddit.display_name}')\n\nif __name__ == '__main__':\n    import asyncio\n    asyncio.run(main())","lang":"python","description":"Minimal async example: create a Reddit instance using environment variables for credentials and fetch a subreddit."},"warnings":[{"fix":"Ensure all API calls that return a coroutine are awaited. Use `await subreddit.submit(...)` and `await comment.reply(...)`.","message":"asyncpraw 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.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Replace `reddit.read_only` with `reddit.reader_mode`.","message":"The `reddit.read_only` attribute to check if the instance is read-only is deprecated in asyncpraw 7.4+. Use `reddit.reader_mode` instead.","severity":"deprecated","affected_versions":">=7.4.0"},{"fix":"Always pass `fetch=True` when calling `reddit.subreddit('subname', fetch=True)` or `reddit.redditor('username', fetch=True)`.","message":"Explicit `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.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Use Python 3.8 to 3.12. Monitor asyncpraw GitHub for 3.13 support.","message":"Asyncpraw does not support Python >=3.13 due to asyncio changes. May raise `RuntimeError: Event loop changed` on Windows or Python 3.13+.","severity":"gotcha","affected_versions":"<=7.8.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `async for submission in subreddit.hot(limit=10):` instead of `await subreddit.hot()`.","cause":"Trying to await an async generator (e.g., `await subreddit.hot()`) instead of iterating over it asynchronously.","error":"TypeError: object async_generator can't be used in 'await' expression"},{"fix":"Fetch the subreddit first: `subreddit = await reddit.subreddit('learnpython', fetch=True)`.","cause":"A lazy-loaded Subreddit object was used without `fetch=True`, so `display_name` is not populated.","error":"AttributeError: 'Subreddit' object has no attribute 'display_name'"},{"fix":"Double-check environment variable names and values. Ensure the Reddit app is a 'script' type. Use `os.environ.get('REDDIT_CLIENT_ID', '')` and verify the values.","cause":"OAuth credentials (client_id, client_secret, username, password) are incorrect or not properly set. Common with environment variable typos.","error":"prawcore.exceptions.OAuthException: invalid_grant error processing request"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}