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
4
votes
1 answer

Is there a way to combine posts/comment streams?

In praw, I can create either a subreddit.stream.comments() or subreddit.stream.submissions(). For those unfamiliar, the two above praw functions return comments/posts as they come in. Is there a way to combine the two? I've tried using Python's…
kpaul
  • 355
  • 6
  • 16
4
votes
4 answers

"AttributeError: '_NotSet' object has no attribute 'lower'" when a PRAW python file is converted to an exe using Pyinstaller

As the title says. When I execute the converted python file (the .exe) I get the following output: Traceback (most recent call last): File "background.py", line 10, in File "site-packages\praw\reddit.py", line 129, in __init__ File…
Recessive
  • 1,780
  • 2
  • 14
  • 37
4
votes
3 answers

Regex to identify Reddit usernames

I am making a bot with a option to not post if the username is not a certain user. Reddit usernames can contain letters in both cases, and have numbers. Which regex can be used to identify such a username? The format is /u/USERNAME where username…
Pokestar Fan
  • 174
  • 1
  • 12
4
votes
1 answer

Writing list of objects to csv file

I am writing a python program that loops through reddit submissions, pulls data, and stores it as an object in a list. However I am having trouble writing that list to a csv file. The file is created but it just gives some kind of id tag for the…
Marjorie Pickard
  • 109
  • 1
  • 2
  • 10
4
votes
4 answers

Frequently receiving 503 error when conducting Reddit search with PRAW

I'm using PRAW to view a large number of Reddit search results (both submissions and comments), and the method I'm using to collect the data is frequently generating a 503 error: prawcore.exceptions.ServerError: received 503 HTTP response As I…
Dreadnaught
  • 125
  • 2
  • 6
4
votes
1 answer

How to scrape all comments from a subreddit on Reddit?

I'm trying to scrape all comments from a subreddit. I've found a library called PRAW. It gives an example import praw r = praw.Reddit('Comment parser example by u/_Daimon_') subreddit = r.get_subreddit("python") comments =…
siamii
  • 23,374
  • 28
  • 93
  • 143
4
votes
1 answer

recursion max error when when using futures.ProcessPoolExecutor but not futures.ThreadPoolExecutor with PRAW wrapper

I am using this code to scrape an API: submissions = get_submissions(1) with futures.ProcessPoolExecutor(max_workers=4) as executor: #or using this: with futures.ThreadPoolExecutor(max_workers=4) as executor: for s in executor.map(map_func,…
4
votes
1 answer

Praw AttributeError: 'NoneType' object has no attribute 'get_comments'

I wrote a simple script for identifying users who contribute to certain subreddits. As a disclaimer, if you plan on using this code you should be sure to anonymize the data (as I will, by aggregating data and removing all usernames). It works with…
Daniel Sussman
  • 257
  • 3
  • 11
4
votes
1 answer

PRAW: Get User's Flair

I'm trying to using PRAW to organize all comments by users active in /r/nba based on their flair. Is there a good way get a user's flair if I have the username? My end goal is to perform some text analysis on user comments grouped by NBA fandom.…
Daniel Sussman
  • 257
  • 3
  • 11
4
votes
1 answer

Python code that works fine on my PC doesn't work on my Raspberry Pi

I recently bought a raspberry pi for many projects, one of which is reddit bots. I'm using PRAW to make the bot and it works perfectly on my desktop PC(Windows 8.1) but on my raspberry by (Raspbian) it doesn't seem to work. I've narrowed it down to…
Chris
  • 2,435
  • 6
  • 26
  • 49
4
votes
1 answer

Using praw, how can I iterate over all of a user's comments?

I'm just wondering if there's a simple enough way to iterate over all comments made by a particular user (I want to check for a particular phrase). Any help is appreciated :)
user3585259
  • 59
  • 1
  • 3
3
votes
1 answer

"A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long"

I'm trying to retrieve messages from Reddit subreddits using PRAW. It is working properly for most of the cases but I'm getting the following error that the message is too long.I'm using pytelegrambotApi Snippet: import praw import telebot bot =…
3
votes
1 answer

What is the best way to fetch all data (posts and their comments) from Reddit?

I have a requirement to analyse all the comments about a subreddit, (e.g. r/dogs, say from 2015 onward) using the Python Reddit API Wrapper (PRAW). I'd like the data to be stored in a JSON. I have found a way to get all of the top, new, hot, etc.…
ml_learner
  • 31
  • 1
  • 7
3
votes
1 answer

RuntimeError: Event loop is closed in asyncpraw python

I am trying to use the asyncpraw library, but I get RuntimeError: Event loop is closed. This is my code and traceback. Code import asyncio import asyncpraw async def main(): reddit = asyncpraw.Reddit('praw_ini_name') print('User is', await…
python_user
  • 5,375
  • 2
  • 13
  • 32
3
votes
0 answers

How do I handle multiple streams and exceptions in Async PRAW correctly vs. PRAW?

I've been using PRAW in my Discord bot to look for new posts in a subreddit using a subreddit stream, and post them to Discord when something new shows up. Reddit sometimes gives HTTP 503 errors, and this used to break the stream completely. With a…
Sidewinder
  • 369
  • 3
  • 13
1
2
3
41 42