Videos
Hey,
I'd like to use Reddit from the command line and someone pointed me to the Reddit API. The documentation struck me as a bit complex, though. Could anyone direct me to some kind of simple list of steps for how to use it?
You have to make an account - then, do you download the API to your system, or do you just send HTTP requests or something? What are some specific examples of usage?
Thanks very much for any assistance.
Hi, is this the only documentation website available for the Reddit API?
- https://www.reddit.com/dev/api/
Hi there, I don't know if this is a stupid question but I can't seem to find a clear cut way to access the Reddit REST API (or does Reddit not have one), which I want to use in a basic Reddit clone app built using Flutter. I have googled quite abit but I haven't found any tutorials which help me understand how to get any sort of data from the API using JSON (there are tutorials for Python and whatnot).
But idk whether I'm missing out on something because I just started researching yesterday and I am at my wit's end. Please, if anyone could give me an easy to understand, step-by-step tutorial on how to even get any data (especially data for a specific user) from the Reddit API using JSON that would be very helpful.
Hey folks how can i get reddit api,i had to submit my bachelor thesis, where i suppose to make sentiment analysis using Reddit extracted text. Sorry for the noob question. Thanks
As of right now, you cannot retrieve a permanent access token. You have 2 options that come close.
The first is to request a "refresh" token when using the standard OAuth flow. That's what you're doing by sending "duration" as "permanent" in your code. The refresh token can be used to automatically retrieve new 1 hour access tokens without user intervention; the only manual steps are on the initial retrieval of the refresh token.
The second alternative, which applies only when writing a script for personal use, is to use the password grant type. The steps are described in more detail on reddit's "OAuth Quick Start" wiki page, but I'll summarize here:
- Create an OAuth client (under https://www.reddit.com/prefs/apps) with type = "script"
- Make a request to
https://www.reddit.com/api/v1/access_tokenwith POST parametersgrant_type=password&username=<USERNAME>&password=<PASSWORD>. Send your client ID and secret as HTTP basic authentication.<USERNAME>must be registered as a developer of the OAuth 2 client ID you send.
A client_id and client_secret can be generated for a reddit account by going to https://www.reddit.com/prefs/apps and creating an app:
The part I have hidden is my client_id.
Then you can use a client like praw to access reddit e.g. with Python:
import praw
r = praw.Reddit(client_id='insert id here',
client_secret='insert secret here',
user_agent='insert user agent')
page = r.subreddit('aww')
top_posts = page.hot(limit=None)
for post in top_posts:
print(post.title, post.ups)
You could use your current browser's user agent, which can be easily found by google searching "what is my user agent" (among other ways).