用 PRAW 修饰帖子

时间:2021-08-01 13:59:46

标签: python praw

我正在使用 PRAW,这是一个 Python Reddit API 客户端。我正在尝试向需要天赋的 subreddit 提交帖子。到目前为止,这是我的代码:

subreddit = reddit.subreddit("test")
subreddit.submit(random.choice(p),selftext=random.choice(pc))

然而,在尝试提交之后...

praw.exceptions.RedditAPIException: SUBMIT_VALIDATION_FLAIR_REQUIRED: 'Your post must contain post flair.' on field 'flair'

添加天赋值后:

subreddit.submit(random.choice(p),selftext=random.choice(pc),flair="other")
TypeError: submit() got an unexpected keyword argument 'flair'

如何为我的帖子添加风格? (我只能找到相关的帖子 is this outdated answer

1 个答案:

答案 0 :(得分:1)

https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html#praw.models.Subreddit.submit

根据模板的 flair_id 值使用 flair_textflair_text_editable