2015-11-02 109 views
1

如果我使用OAuth,我無法從subreddit獲取新的意見或評論。PRAW:使用OAuth授權可阻止我獲得提交/評論

我的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。我究竟做錯了什麼?

+0

想讓您知道您可以在您提出的問題下發布自己的答案。對於搜索整體解決方案的任何人來說,它更有條理,更輕鬆。 – Saroekin

+0

@Saroekin謝謝,這是我的第一篇文章。 – AjaxGb

回答

2

我自己找到了解決方案。要閱讀帖子,您需要在請求的作用域列表中「讀取」。所以,"identity submit"應該是"identity read submit"