Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Reddit' object has no attribute 'get_subreddit' #9

Closed
dasbuilder opened this issue Jan 21, 2019 · 1 comment
Closed

Comments

@dasbuilder
Copy link

I'm seeing an AttributeError when running on python3.6 or 3.7 currently:

Traceback (most recent call last):
  File "newsbot.py", line 24, in <module>
    handle_incoming_messages(States.last_updated)
  File "/Users/spencer.anderson/testing/pythonshenanigans/tgramred/docker_subred_fetch/telegram.py", line 85, in handle_incoming_messages
    summarized_news = get_latest_news(sources_dict[person_id])
  File "/Users/spencer.anderson/testing/pythonshenanigans/tgramred/docker_subred_fetch/reddit.py", line 29, in get_latest_news
    submissions = r.get_subreddit(sub_reddits).get_top(limit=5)
AttributeError: 'Reddit' object has no attribute 'get_subreddit'

I made the call this, however this will likely only work with 1 subreddit and not multiple.
submissions = r.subreddit(sub_reddits).top(limit=5)

It was submissions = r.get_subreddit(sub_reddits).get_top(limit=5)

@SathyaBhat
Copy link
Collaborator

Thanks for reporting. The r.subreddit(sub_reddits).top(limit=5) will work with multiple subreddits as well. This was a result of praw version upgrade which was corrected in later exercises but not this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants