Explore how to use Python's PRAW library to interact with Reddit's API. Understand how to obtain API keys, retrieve top stories, navigate subreddits, and access submission comments for practical API integration.
We'll cover the following...
About Reddit
Reddit is a very popular entertainment and social news networking service. It’s kind of like Slashdot in that users vote on which stories are the best and they can get promoted to the front page. A few years ago, Digg used to be the big site that did this sort of thing. Reddit has lots of sub-sites called subreddits that are devoted to specific subjects, like gaming, photos, programming languages, etc.
Get started with reddit
Reddit has also published an API that has been wrapped by some clever Python programmers. It is called PRAW: The Python Reddit Api Wrapper. We can install PRAW using pip:
pip3 install praw
Now that we have that installed, let’s give praw a try. We will try getting the top 25 stories on Reddit right now.
We will need API keys i.e.
client_idand ...