【发布时间】:2021-07-17 07:51:43
【问题描述】:
我正在使用 Reddit API 制作一个 python 机器人,以下是我的代码,为了安全起见,正在替换应用程序密码和 ID,但它们是正确的。
import praw
reddit = praw.Reddit(
client_id="id",
client_secret="secret",
username='username',
password='password',
user_agent="python:com.example.myredditapp:v1.2.3 (by u/MattCodes2003)",
)
subreddit = reddit.subreddit('python')
hot_python = subreddit.hot(limit=5)
for submission in hot_python:
print(submission)
但是当我运行代码时出现以下错误:
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
我对这个错误感到很困惑,因为我一直遵循的教程和文档没有收到这个错误,任何帮助都会很棒!
【问题讨论】: