如何使用 PRAW (Python) 在 Reddit 中回复带有图像的消息

问题描述 投票:0回答:0

我在用图像回复消息到我拥有的 Reddit 线程时遇到问题。我一直在尝试各种解决方案,但似乎都不起作用,我什至将我的图像上传到图像托管服务,但它仍然无法正常工作。这是我的代码:

import praw
import prawcore.exceptions

reddit = praw.Reddit(client_id='client_ID',
                     client_secret='client_Secret',
                     username='username',
                     password='pass',
                     user_agent='user_agent')

submission = reddit.submission(id='thread_id')

message = "Check out this cool link: [link text](https://stackoverflow.com/questions/25100651/praw-replying-to-a-post) \n\n And here's an image: ![This is a image](https://thumbs2.imgbox.com/db/53/Dt9U1RJW_t.png)"

try:
    submission.reply(message)
except prawcore.exceptions.RequestException as e:
    print(f"Error: {e}")

谢谢!

python reddit praw
© www.soinside.com 2019 - 2024. All rights reserved.