PRAW: Comment Sender Name

I am developing a reddit bot that needs to know which user posted a comment.

According to the docs of the PRAW APIs, there is no specific way to get the name of the comment author. Ideally, I could immediately return the username. If this is not possible, is there a way to get the author’s full name and then convert it to username?

+4
source share
2 answers

I support PRAW. Where does it say that you cannot get the username of the Commentauthor of the objects? Because it is wrong and needs to be fixed.

, Comment author, Redditor .

import praw

r = praw.Reddit(UNIQUE_AND_DESCRIPTIVE_USERAGENT)
submission = r.get_submission("http://www.reddit.com/r/redditdev/comments/16m0uu/praw_20_is_coming_release_in_2_days/")
comment = submission.comments[0]
author = comment.author  # This returns a ``Redditor`` object.
print(author.name)  # The username
+8

, . @Humus , PRAW readthedocs.org. . dir(object_name) . .

: pprint(vars(object_name))

+2

All Articles