我正在为学校项目制作reddit机器人,并且我正在使用praw并运行以下代码
for comment in subreddit.stream.comments():
if keyphrase in comment.body:
word = comment.body.replace(keyphrase, '')
try:
if isWord(word):
comment.reply('Hello')
print('posted')
except:
print('to frequent')
我收到此错误
redditbot.py", line 13, in <module>
for comment in subreddit.stream.comments():
File "C:\Python37\lib\site-packages\praw\models\util.py", line 171, in stream_generator
limit=limit, params={'before': before_attribute}))):
File "C:\Python37\lib\site-packages\praw\models\listing\generator.py", line 52, in __next__
self._next_batch()
File "C:\Python37\lib\site-packages\praw\models\listing\generator.py", line 62, in _next_batch
self._listing = self._reddit.get(self.url, params=self.params)
File "C:\Python37\lib\site-packages\praw\reddit.py", line 408, in get
data = self.request('GET', path, params=params)
File "C:\Python37\lib\site-packages\praw\reddit.py", line 534, in request
params=params)
File "C:\Python37\lib\site-packages\prawcore\sessions.py", line 185, in request
params=params, url=url)
File "C:\Python37\lib\site-packages\prawcore\sessions.py", line 116, in _request_with_retries
data, files, json, method, params, retries, url)
File "C:\Python37\lib\site-packages\prawcore\sessions.py", line 101, in _make_request
params=params)
File "C:\Python37\lib\site-packages\prawcore\rate_limit.py", line 35, in call
kwargs['headers'] = set_header_callback()
File "C:\Python37\lib\site-packages\prawcore\sessions.py", line 145, in _set_header_callback
self._authorizer.refresh()
File "C:\Python37\lib\site-packages\prawcore\auth.py", line 328, in refresh
password=self._password)
File "C:\Python37\lib\site-packages\prawcore\auth.py", line 142, in _request_token
payload.get('error_description'))
prawcore.exceptions.OAuthException: invalid_grant error processing request
不确定是否有帮助,但请提前感谢。