Reputation: 77
Help I am stuck! Just writing python using reddit api wrapper when all of a sudden I learn that I do not know how to use the upvote/downvote feature. I just need to know how to target the post or comment. It is specified in item (see below) and I think it is declared in a variable.
item.upvote()
Upvotes: 0
Views: 2491
Reputation: 235
item
can be either a submission
or a comment
.
You can get individual submissions using r.get_submission
, or get top submissions from a subreddit with something like r.get_subreddit('python').get_top(limit=10)
. A list of comments on a submission is at submission.comments
(Untested) example:
r = reddit.Reddit(user_agent='example')
r.login('username', 'password')
submission = r.get_submission('http://www.reddit.com/r/pics/comments/92dd8/test_post_please_ignore/')
submission.upvote()
submission.comments[0].upvote()
Upvotes: 4