首页 > 解决方案 > 使用 PRAW 时出现 401 状态错误(reddit)

问题描述

import praw
import pandas as pd

reddit = praw.Reddit("bot1")

posts=[]
target_subreddit=reddit.subreddit("Python")
for post in target_subreddit.hot(limit=10):
        posts.append([pos.title, post.score, post.url])
        posts=pd.DataFrame(posts, columns=['title','score','url'])

posts.to_csv('result.csv', sep='\t', encoding='utf=8')

我已经使用名为 bot1 的 client_id、client_secret 和 user_agent 配置了 praw.ini 文件。在运行此代码时,我遇到了 prawcore.exceptions.ResponseException: received 401 HTTP error

谁能让我知道是什么问题?

标签: python-3.xredditpraw

解决方案


推荐阅读