praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

Home Page:http://praw.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

over_18 for a comment

fatadel opened this issue · comments

Describe the Bug

When fetching comments from a stream, e.g., reddit.subreddit('all').stream.comments(), they do have the over_18 field. However, when constructing a comment with a bare constructor (reddit.comment(SOME_ID)), they don't have this field.

Is that a bug?

Desired Result

An instance of a comment always has the same attributes regardless of how it is constructed (i.e., from the stream or with the constructor).

Relevant Logs

No response

Code to reproduce the bug

import praw
reddit = praw.Reddit('my_bot')
for comment in reddit.subreddit('all').stream.comments():
    print(comment.over_18)  # <---- This works
    comment_id = comment.id
    break

reddit.comment(comment_id).over_18  # <---- This throws an error

My code example does not include the Reddit() initialization to prevent credential leakage.

Yes

This code has previously worked as intended.

No

Operating System/Environment

macOS Monterey 12.2.1

Python Version

Python 3.9.13

PRAW Version

7.6.0

Prawcore Version

2.3.0

Anything else?

I've asked the same here - https://www.reddit.com/r/redditdev/comments/yet7ej/over_18_for_a_comment/.

There isn't much PRAW can do if Reddit isn't returning that field. You could try doing this:

comment = reddit.comment(id)
comment.score
print(vars(comment))

And see if the field you're looking for is present under a different name.

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 30 days.