-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_praw.py
39 lines (28 loc) · 1.19 KB
/
test_praw.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import logging
# import praw
import sys
import climb_bot
# import Config
if sys.platform == 'win32':
climb_bot.configpath = 'C:/projects/climb_bot/config.json' # where to find the config JSON
else:
climb_bot.configpath = './config.json' # path on linux server, duh it's in the same directory
# config = Config.Config(configpath)
reddit_client = climb_bot.init()
climb_bot.config.reddit_commentsPerCheck = 3
subreddit = "test"
logging.info('Getting ' + str(climb_bot.config.reddit_commentsPerCheck) + ' comments from r/' + subreddit)
for comment in reddit_client.subreddit(subreddit).comments(limit=climb_bot.config.reddit_commentsPerCheck):
# print(comment, comment.link_permalink)
print(comment.link_permalink + str(comment) + '/') # here is how to generate a full link to the comment
# TODO find a comment based only on it's id: dtbkk0a
test_comment = 'dtbkk0a'
comment = reddit_client.comment(test_comment)
print(comment, comment.body)
print(comment, comment.permalink)
print('https://www.reddit.com' + comment.permalink)
print(comment, comment.submission)
print(dir(comment))
comment = reddit_client.comment(test_comment)
link = 'https://www.reddit.com' + comment.permalink
print(link)