Open SylvainDe opened 7 years ago
A few other APIs have changed ("get" prefix are removed everywhere). I had to perform the following changes to make things work:
- reddit_api = praw.Reddit('reddit Twitter tool monitoring {}'.format(subreddit))
- subreddit = reddit_api.get_subreddit(subreddit)
- return subreddit
+ reddit_api = praw.Reddit(
+ user_agent='reddit Twitter tool monitoring {}'.format(subreddit_name),
+ client_id='xxxxxxxxx',
+ client_secret='yyyyyyyyyyyyyy')
+ return reddit_api.subreddit(subreddit_name)
and
- for submission in subreddit_info.get_hot(limit=5):
+ for submission in subreddit_info.hot(limit=5):
Also, the link used did not seem correct but this might be specific to the code I had locally.
Also, the permalink
attribute on submission is now a relative link so: 1) the link will not work 2) the link will not be detected by Twitter as a link, will not be substituted by a (usually shorter) link and the tweet is likely to be more than 140 char longs...
I ran into this same problem, does the issue with relative links apply to external links (imgur for example)?
I guess it only applies to reddit links...
After a system upgrade, I've created a new virtual env, installed Praw in it and tried to run the script and got this exact issue:
http://stackoverflow.com/questions/36361826/keyerror-when-assigning-praw-reddit-to-variable
I guess that the API of Praw has changed. I open this issue to share my findings/progress (if any).