【发布时间】: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