PRAW:使用OAuth授权阻止我收到提交/评论

时间:2015-11-02 10:42:40

标签: python python-3.x python-3.4 reddit praw

如果我使用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。我做错了什么?

1 个答案:

答案 0 :(得分:2)

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