如果我使用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)
在那之后,我可以试着得到意见书
^{pr2}$或评论
^{3}$但是如果我使用其中一个值,程序会崩溃并出现错误:
raise OAuthInsufficientScope('insufficient_scope', response.url)
praw.errors.OAuthInsufficientScope: insufficient_scope on url https://oauth.reddit.com/r/test/comments/.json
{1}如果没有,就不要使用。我使用的是python3.4。我做错什么了?在
我自己找到了解决办法。要阅读帖子,您需要在请求的作用域列表中“read”。所以,
"identity submit"
应该是"identity read submit"
。在相关问题 更多 >
编程相关推荐