Questions tagged [praw]

PRAW (Python Reddit API Wrapper) is a python package used to access and interact with the reddit API.

PRAW, short for Python Reddit API Wrapper, is a python package that allows for simple access to ’s API. PRAW aims to be as easy to use as possible and is designed to follow all of reddit’s API rules. You have to give a useragent that follows the rules, everything else is handled by PRAW so you needn’t worry about violating them.

617 questions
17
votes
3 answers

Get all comments from a specific reddit thread in python

The official way, r = praw.Reddit('Comment Scraper 1.0 by u/_Daimon_ see ' 'https://praw.readthedocs.org/en/latest/' 'pages/comment_parsing.html') submission =…
Phylliida
  • 4,217
  • 3
  • 22
  • 34
15
votes
3 answers

PRAW 6: Get all submission of a subreddit

I'm trying to iterate over submissions of a certain subreddit from the newest to the oldest using PRAW. I used to do it like this: subreddit = reddit.subreddit('LandscapePhotography') for submission in subreddit.submissions(None, time.time()): …
Curtwagner1984
  • 1,908
  • 4
  • 30
  • 48
8
votes
2 answers

Getting more than 100 search results with PRAW?

I'm using the following code to obtain reddit search results with PRAW 4.4.0: params = {'sort':'new', 'time_filter':'year'} return reddit.subreddit(subreddit).search('', **params) I'd like to scrape an indefinite amount of posts from the subreddit,…
Dreadnaught
  • 125
  • 2
  • 6
7
votes
1 answer

environment variables not updating

I am using the dotenv package. I had a key that I had saved in my .env file but I updated it to a new key, but my script still outputs the old key. I have the ".env" file in the root directory. I thought that by using load_dotenv() that it's taking…
hope288
  • 725
  • 12
  • 23
7
votes
2 answers

PRAW: Replying to a post

As the title says, I'm unable to find the function in PRAW to reply to a post on Reddit. I've written a rather simple bot so far, which looks for new posts on a certain subreddit. My problem is that once finding the submission, I can't find how to…
agsl
  • 151
  • 2
  • 8
6
votes
1 answer

Get Reddit usernames of users who use a specific subreddit

I would like to generate a list of usernames of users who use a specific subreddit. As far as I know, it is not possible to simply get a list of users who subscribed to the subreddit. If that's not possible, it would probably be the best to go…
Hillcow
  • 890
  • 3
  • 19
  • 48
6
votes
2 answers

PRAW: How to get a reddit comment object with just the comment ID?

I'm working on a bot where I only have the comment IDs, e.g., t1_asdasd. I don't have access to the parent thread or anything. Can I pull the corresponding comment object with just the comment ID?
Randy Olson
  • 3,131
  • 2
  • 26
  • 39
5
votes
2 answers

I want to scrape reddit data using praw. I am getting raise ResponseException(response) error after adding the for loop

subredditcmv=reddit.subreddit('changemyview') cmv_subreddit=subredditcmv.top(limit=15) cmv_dict={"Title":[], \ "Score":[], \ "id":[], \ "number_of_comments":[],\ "post":[],\ "created":[] …
5
votes
1 answer

Connection reset by peer - reddit api

I am trying to make a long-running Python script that periodically queries Reddit for new submissions/comments using PRAW 4.4.0 and at first I initialize the object like this: redditClient = praw.Reddit( client_id=constants.REDDIT_CLIENT_ID, …
Dorin
  • 2,167
  • 4
  • 20
  • 32
5
votes
1 answer

Get Reddit user comments using PRAW causing TypeError: 'SubListing' object is not callable error

I'm trying to retrieve the last 1000 comments from a user since 1000 is the Reddit limit. I followed the code example here, and modified a few of the calls for the updated API. Such as user.get_comments now seems to be just user.comments. Here is…
5
votes
2 answers

Handling a timeout exception in Python

I'm looking for a way to handle timeout exceptions for my Reddit bot which uses PRAW (Python). It times out at least once every day, and it has a variable coded in so I have to update the variable and then manually run the bot again. I am looking…
Matt T.
  • 144
  • 1
  • 1
  • 9
5
votes
1 answer

Detecting NSFW submissions with praw

I'm using PRAW to scrape for some content from reddit. I can get info on a submission (praw.objects.Submission), but I don't see from the documentation how to tell if the post is flagged as NSFW or not. Is it possible to figure this out through PRAW…
dunstantom
  • 551
  • 2
  • 5
  • 10
5
votes
2 answers

How do you get the url from Submission object in PRAW?

I'm using PRAW to create a Reddit bot that submits something once a day. After submitting I want to save the url of the submission and write it to a text file. url = r.submit(subreddit, submission_title, text=submission_text) The above returns a…
Amos
  • 1,154
  • 1
  • 16
  • 35
5
votes
2 answers

Reddit search API not giving all results

import praw def get_data_reddit(search): username="" password="" r = praw.Reddit(user_agent='') r.login(username,password,disable_warning=True) posts=r.search(search, subreddit=None,sort=None,…
Abhishek Bhatia
  • 9,404
  • 26
  • 87
  • 142
5
votes
2 answers

IntegrityError: datatype mismatch in Python using praw

I am trying to write a reddit bot that takes the word "fuck" and see how many people say that on reddit. Here is the code: import praw import time import re import sqlite3 username = "LewisTheRobot" password = "lewismenelaws" conn =…
Lewis Menelaws
  • 1,186
  • 5
  • 20
  • 42
1
2 3
41 42