【问题标题】:PRAW: Authorizing with OAuth prevents me from getting submissions/commentsPRAW:使用 OAuth 进行授权会阻止我收到提交/评论
【发布时间】:2015-11-13 09:39:21
【问题描述】:

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

我的 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()

或cmets

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

【问题讨论】:

  • 想让您知道您可以在您提出的问题下发布您自己的答案。对于正在寻找整体解决方案的任何人来说,它更有条理,也更容易。
  • @Saroekin 谢谢,这是我的第一篇文章。

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2014-01-16
    • 2013-03-14
    • 2014-12-13
    • 2014-09-05
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 2010-12-07
    • 2021-09-03
    相关资源
    最近更新 更多