Use PRAW to Interact With Posts and Comments
Explore how to use the Python Reddit API Wrapper (PRAW) to create and manage posts and comments on Reddit. Learn to submit posts, reply with comments, and efficiently read posts and comment threads from subreddits.
We'll cover the following...
Make a post
We can make a post using the submit() method. We'll need to provide the title and the body to submit the post.
Here are some important parameters we'll use to call the method:
Parameter | Type | Category | Description |
| string | required | The title we want in our new post. |
| string | required | The body of the post. |
Press "Run" to submit a new post to a subreddit.
Lines 4–9: We initialize the Reddit class, the parameters are explained here.
Line 11: We obtain an instance of the Subreddit class.
Lines 12–13: We make the variables title and selftext to ...