ResponseException:尝试用Praw刮擦Reddit数据时接收到401 HTTP响应 - 如何进行身份验证?

发布于 2025-02-06 12:22:40 字数 736 浏览 2 评论 0原文

我正在尝试从创建的应用程序中刮除一些Reddit数据,后来我想将它们输入到DataFrame PR CSV文件中。我不断收到以下错误:

ResponseException: received 401 HTTP response

我的代码是非常标准的:

import praw
    reddit = praw.Reddit(client_id='', client_secret='', user_agent='', password='', username='',)
    # get 10 hot posts from the MachineLearning subreddit
    hot_posts = reddit.subreddit('MachineLearning').hot(limit=10)
    for post in hot_posts:
        print(post.title)

有关此错误的其他解决方案一直说您必须对自己进行身份验证。但是这是什么意思? The reddit solutions on https://github.com/reddit-档案/reddit/wiki/oauth2#应用程序 - only-oauth 仍然很困惑。

I am trying to scrape some reddit data from the application I created, I later want to input them into a dataframe pr CSV file. I keep receiving the following error:

ResponseException: received 401 HTTP response

My code is pretty standard:

import praw
    reddit = praw.Reddit(client_id='', client_secret='', user_agent='', password='', username='',)
    # get 10 hot posts from the MachineLearning subreddit
    hot_posts = reddit.subreddit('MachineLearning').hot(limit=10)
    for post in hot_posts:
        print(post.title)

Other solutions about this error keep saying you have to authenticate yourself. But what does this mean? The reddit solutions on https://github.com/reddit-archive/reddit/wiki/OAuth2#application-only-oauth are still pretty confusing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文