0

Trying to post to a subreddit that requires flairs

reddit.subreddit('test').submit(title,url=link,flair_id='')

i didn't know how to find the flair_id of a subreddit ?

also when I try to share an image with praw using

Trying to post to a subreddit that requires flairs

reddit.subreddit('').submit_image(title,image_path=image,flair_id='')

how should i write the image path ?

tamer_mz
  • 33
  • 4

2 Answers2

0

You can find the available flair ids with

reddit.subreddit("test").flair.templates

The image path is a path relative to the script

ex.

script/
     - main.py
     - image.png
reddit.subreddit('').submit_image(title, image_path="image.png")
MiranDaniel
  • 59
  • 1
  • 7
0

The info to print flair_id can be found here

template_info = list(subreddit.flair.templates)[0]
subreddit.flair.templates.update(
template_info["id"],
text=template_info["flair_text"],
text_editable=True,
)

https://praw.readthedocs.io/en/latest/code_overview/other/subredditlinkflairtemplates.html#praw.models.reddit.subreddit.SubredditLinkFlairTemplates.user_selectable

Andy Kim
  • 21
  • 3