Menu
  • HOME
  • TAGS

get URL of any submission for subreddits

python,reddit,praw

PRAW allows you to do this: To get the submitted link you can use submission.url [submission] = submissions.get_new(limit=1) print submission.url Or if you're looking for the URL for the actual post to Reddit then you can use permalink [submission] = submissions.get_new(limit=1) print submission.permalink ...

Try block not catching - Am I making inadvertent internet access?

python,try-catch,praw

It looks like praw is going to lazily get objects, so when you actually use subreddit_posts is when the request gets made, which explains why it's blowing up on that line. See: https://praw.readthedocs.org/en/v2.1.20/pages/lazy-loading.html ...

How to get comments from last week using PRAW?

python,reddit,praw

You can see in the source code that the time parameter is passed to the API as t. According to the Reddit API documentation: t: one of (hour, day, week, month, year, all) ...

Incorrect conversion from epoch time when scrapping web

python,datetime,python-datetime,praw

I didn't get your exact problem about how is the "Incorrect". There are two attributes about the created time "created" and "created_utc". Maybe you want to try the second one instead.

IntegrityError: datatype mismatch in Python using praw

python,sqlite,praw

Alright figured it out. My datatype for the ID field was an integer however reddit's ID for comments. example: "cogr0o4". So I changed that to the datatype "TEXT" and made sql statement convert it into a string.

PRAW get_redditor() slow?

python,performance,reddit,praw

PRAW's getters typically return lazy objects, meaning that they only request data from Reddit's servers when you actually try to use the object. This is consistent with your very fast function calls -- everything is happening locally. Your get_redditor() call is probably requesting the data immediately (though I couldn't say...

Praw AttributeError: can't set attribute

python,bots,reddit,attributeerror,praw

I believe that this error is a result of this recent reddit update. From the above link: This change may also have some unexpected side-effects on third-party extensions/apps/etc. that display or otherwise use the specific up/down numbers. We've tried to take various precautions to make the transition smoother, but please...

Praw: Where, oh where, have the self.texts all gone?

praw

This was more of a personal error. the praw.objects.Submission.selftext asset still exists, but isn't visible through dir() introspection.

Cannot find PRAW config file when wrapping application with py2app

python,pyinstaller,py2app,praw

I came across this error today - not in the context of py2app, but after a pip upgrade of praw. In case you still have this problem (unlikely :)) and/or in the interest of posterity, here's how I was able to fix it: I noticed that the error was in...

Using regular expressions to match a word in Python

python,regex,praw

You're checking with string operations, not RE ones, in isMatch = any(string in comment_text for string in word_to_match) The first in here checks for a substring -- nothing to do with REs. Change this to isMatch = any(re.search(string, comment_text) for string in word_to_match) Moreover, you have an error in your...

Reddit search API not giving all results

python,python-2.7,praw

Limiting results on a search or list is a common tactic for reducing load on servers. The reddit API is clear that this is what it does (as you have already flagged). However it doesn't stop there... The API also supports a variation of paged results for listings. Since it...

Fixing UnboundLocalError revolving around “local variable ' ' referenced before assignment.”

python,runtime-error,praw

It looks to me that the problem is in the finalized_message_text. You should initialize usedWord = "" before the for loop. That should fix it. Or add the final Else statement to initialize usedWord = ""