1

如果我使用 OAuth,我将无法从 subreddit 获得新的提交或评论。

我的 Oauth 代码如下所示:

import praw
import webbrowser

r = praw.Reddit(user_agent)
r.set_oauth_app_info(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI)
authURL = r.get_authorize_url("FUZZYPICKLES", "identity submit", True)

webbrowser.open(authURL)
authCode = input("Enter the code: ")

accInfo = r.get_access_information(authCode)

之后我可以尝试获得提交

submission = r.get_subreddit("test").get_new()

或评论

comments = r.get_comments("test")

但如果我使用任何一个值,程序会因错误而崩溃:

raise OAuthInsufficientScope('insufficient_scope', response.url)
praw.errors.OAuthInsufficientScope: insufficient_scope on url https://oauth.reddit.com/r/test/comments/.json

如果我不使用 OAuth,无论是通过使用login()还是不授权,我都没有这样的问题。我正在使用 Python 3.4。我究竟做错了什么?

4

1 回答 1

2

我自己找到了解决方案。要阅读帖子,您需要在请求的范围列表中“阅读”。所以,"identity submit"应该是"identity read submit"

于 2015-11-13T01:39:21.853 回答