PRAW:使用OAuth授权会阻止我获取提交/评论

2024-10-08 19:29:05 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: importclienturlget评论oauthauthcodescope
1条回答
网友
1楼 · 发布于 2024-10-08 19:29:05

我自己找到了解决办法。要阅读帖子,您需要在请求的作用域列表中“read”。所以,"identity submit"应该是"identity read submit"。在

相关问题 更多 >

    热门问题