I'm trying to get the top submission from a subreddit which is not sticky.
Tried something like this:
reddit = praw.Reddit(client_id='xx', client_secret='yy', user_agent='zz')
submissions = reddit.subreddit('theSubreddit').hot(limit=1, sticky=True)
But it doesn't work, only returning an error saying sticky
is not a valid argument. How can I achieve this? I'm using PRAW version 4.3.0
Note I have cross-posted this question here.
There is a similar question posted earlier, but this is different. In my case, the limit
is 1
. I'm only targeting the top non-sticky submission. So, manually checking submission.stickied
inside a loop will not return me anything if the top submission is a sticky one.
Just got the solution from Reddit where I posted this same question. Thanks to the Reddit user bboe.
submission = next(x for x in reddit.subreddit('theSubreddit').hot() if not x.stickied)
Surely this is not an iterable object / Array which I was previously getting.
This is just a single object where I don't need to iterate to get its properties.