我試圖從用戶檢索最後1000條評論,因爲1000是Reddit限制。使用PRAW獲取Reddit用戶註釋導致TypeError:'SubListing'對象不可調用錯誤
我跟着代碼示例here,並修改了更新API的一些調用。比如user.get_comments現在好像只是user.comments。
這是我運行的代碼。
import praw
my_user_agent = 'USERAGENT'
my_client_id = 'CLIENTID'
my_client_secret = 'SECRET'
r = praw.Reddit(user_agent=my_user_agent,
client_id=my_client_id,
client_secret=my_client_secret)
user = r.redditor('REDDITUSERNAME')
for comment in user.comments(limit=None):
print comment.body
雖然我每次都會在最後一行發生錯誤。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'SubListing' object is not callable
我已經連接到所述API和具有如我可以做打印(user.comment_karma)的有源連接,並將其正確顯示。
任何想法我做錯了什麼?
你不應該使用代碼格式的錯誤日誌,[元問題](http://meta.stackoverflow.com/questions/276966/quote-formatting-messing-up-how-to-handle-format -of-錯誤日誌)。 – Stargateur
@Stargateur感謝您的收穫。根據meta post編輯問題。 – TheBeginningEnd
你在使用PRAW 3還是4?自從這個例子以來,我相信這個API可能會發生一些變化。 – Aurora0001