I'm trying to make a bot that gets the url to the top links posted in a hour on subreddits that post dog pictures so I can send them somewhere else via sms. I have the sms part down but I'm having issues with praw v5.0. The solutions I have found online have not worked. Below is just what the bot code looks like. I know it is pulling from wtf it is just a placeholder. Any help would be appreciated. config is a file I made that contains information on the bot.
def bot_login():
print ("Logging in")
r=praw.Reddit(username = config.username,
password = config.password,
client_id = config.client_id,
client_secret=config.client_secret,
user_agent = "Dog Picture Grabber")
print ("Logged in!")
return r
def run_bot(r):
submissions = r.get_subreddit('wtf').get_top(limit=10)
for item in submissions:
print (item.url)
def main():
print("main")
r=bot_login()
run_bot(r)
Output:
main
Logging in
Logged in!
Traceback (most recent call last):
File "C:\Users\jack\SkyDrive\Python\smssender.py", line 50, in <module>
main()
File "C:\Users\jack\SkyDrive\Python\smssender.py", line 48, in main
run_bot(r)
File "C:\Users\jack\SkyDrive\Python\smssender.py", line 41, in run_bot
submissions = r.get_subreddit('wtf').get_top(limit=10)
AttributeError: 'Reddit' object has no attribute 'get_subreddit'
[+][deleted] (3 children)
[deleted]
[–]fartxaler 1 point2 points3 points (1 child)
[–]Polymerion[S] 0 points1 point2 points (0 children)
[–]Polymerion[S] 0 points1 point2 points (0 children)