SubredditFlair — PRAW 7.6.0 Documentation

Contents Menu Expand Light mode Dark mode Auto light/dark mode Hide navigation sidebar Hide table of contents sidebar PRAW 7.7.1 documentation

Getting Started

  • Quick Start
  • Installing PRAW
  • Authenticating via OAuth
  • Configuring PRAWToggle navigation of Configuring PRAW
    • Configuration Options
    • praw.ini Files
    • Keyword Arguments to Reddit
    • PRAW Environment Variables
  • Running Multiple Instances of PRAW
  • Logging in PRAW
  • Ratelimits
  • Frequently Asked Questions

Code Overview

  • The Reddit InstanceToggle navigation of The Reddit Instance
    • reddit.live
    • reddit.front
    • reddit.inbox
    • reddit.live
    • reddit.multireddit
    • reddit.redditors
    • reddit.subreddit
    • reddit.subreddits
    • reddit.user
  • Working with PRAW’s ModelsToggle navigation of Working with PRAW’s Models
    • Comment
    • Draft
    • LiveThread
    • LiveUpdate
    • Message
    • ModmailConversation
    • MoreComments
    • Multireddit
    • Redditor
    • Submission
    • Subreddit
    • WikiPage
  • Exceptions in PRAW
  • Other ClassesToggle navigation of Other Classes
    • Collection
    • CollectionModeration
    • SubredditCollections
    • SubredditCollectionsModeration
    • SubmissionFlair
    • SubredditFlair
    • SubredditFlairTemplates
    • SubredditLinkFlairTemplates
    • SubredditRedditorFlairTemplates
    • InlineGif
    • InlineImage
    • InlineMedia
    • InlineVideo
    • BaseModNotes
    • ModNote
    • ModNoteMixin
    • RedditModNotes
    • RedditorModNotes
    • SubredditModNotes
    • CommentModeration
    • RuleModeration
    • SubmissionModeration
    • SubredditModeration
    • SubredditRulesModeration
    • SubredditWidgetsModeration
    • ThingModerationMixin
    • UserSubredditModeration
    • WidgetModeration
    • WikiPageModeration
    • LiveContributorRelationship
    • LiveThreadContribution
    • LiveThreadStream
    • LiveUpdateContribution
    • ContributorRelationship
    • ModeratorRelationship
    • SubredditRelationship
    • SubredditEmoji
    • SubredditFilters
    • SubredditModerationStream
    • SubredditQuarantine
    • SubredditRemovalReasons
    • SubredditRules
    • SubredditStream
    • SubredditStylesheet
    • SubredditWidgets
    • SubredditWiki
    • Button
    • ButtonWidget
    • Calendar
    • CalendarConfiguration
    • CommunityList
    • CustomWidget
    • Hover
    • IDCard
    • Image
    • ImageData
    • ImageWidget
    • Menu
    • MenuLink
    • ModeratorsWidget
    • PostFlairWidget
    • RulesWidget
    • Styles
    • Submenu
    • TextArea
    • Widget
    • Auth
    • BaseList
    • CommentForest
    • CommentHelper
    • Config
    • DomainListing
    • DraftList
    • Emoji
    • FullnameMixin
    • InboxableMixin
    • ListingGenerator
    • ModAction
    • ModNote
    • ModeratedList
    • Modmail
    • ModmailMessage
    • PollData
    • PollOption
    • PartialRedditor
    • PRAWBase
    • Preferences
    • RedditBase
    • RedditorList
    • RedditorStream
    • RemovalReason
    • Rule
    • Stylesheet
    • SubListing
    • SubredditMessage
    • Token Manager
    • Trophy
    • UserSubreddit
    • Util

Tutorials

  • Comment Extraction and Parsing
  • Working with Refresh Tokens
  • Submission Stream Reply Bot

Package Info

  • Change Log
  • Contributing to PRAW
  • Glossary
  • Migrating to PRAW 7.X
  • References
  • Sponsors
  • Index
Back to top Edit this page Toggle Light / Dark / Auto color theme Toggle table of contents sidebar SubredditFlair# classpraw.models.reddit.subreddit.SubredditFlair(subreddit:praw.models.Subreddit)#

Provide a set of functions to interact with a Subreddit’s flair.

__call__(redditor:praw.models.Redditor|str|None=None, **generator_kwargs:Any) Iterator[praw.models.Redditor]#

Return a ListingGenerator for Redditors and their flairs.

Parameters:

redditor – When provided, yield at most a single Redditor instance (default: None).

Additional keyword arguments are passed in the initialization of ListingGenerator.

Usage:

for flair in reddit.subreddit("test").flair(limit=None): print(flair) __init__(subreddit:praw.models.Subreddit)#

Initialize a SubredditFlair instance.

Parameters:

subreddit – The subreddit whose flair to work with.

configure(*, link_position:str='left', link_self_assign:bool=False, position:str='right', self_assign:bool=False, **settings:Any)#

Update the Subreddit’s flair configuration.

Parameters:
  • link_position – One of "left", "right", or False to disable (default: "left").

  • link_self_assign – Permit self assignment of link flair (default: False).

  • position – One of "left", "right", or False to disable (default: "right").

  • self_assign – Permit self assignment of user flair (default: False).

subreddit = reddit.subreddit("test") subreddit.flair.configure(link_position="right", self_assign=True)

Additional keyword arguments can be provided to handle new settings as Reddit introduces them.

delete(redditor:praw.models.Redditor|str)#

Delete flair for a Redditor.

Parameters:

redditor – A redditor name or Redditor instance.

See also

update() to delete the flair of many redditors at once.

delete_all() List[Dict[str,str|bool|Dict[str,str]]]#

Delete all Redditor flair in the Subreddit.

Returns:

List of dictionaries indicating the success or failure of each delete.

link_templates() praw.models.reddit.subreddit.SubredditLinkFlairTemplates#

Provide an instance of SubredditLinkFlairTemplates.

Use this attribute for interacting with a Subreddit’s link flair templates. For example to list all the link flair templates for a subreddit which you have the flair moderator permission on try:

for template in reddit.subreddit("test").flair.link_templates: print(template) set(redditor:praw.models.Redditor|str, *, css_class:str='', flair_template_id:str|None=None, text:str='')#

Set flair for a Redditor.

Parameters:
  • redditor – A redditor name or Redditor instance.

  • text – The flair text to associate with the Redditor or Submission (default: "").

  • css_class – The css class to associate with the flair html (default: ""). Use either this or flair_template_id.

  • flair_template_id – The ID of the flair template to be used (default: None). Use either this or css_class.

This method can only be used by an authenticated user who is a moderator of the associated Subreddit.

For example:

reddit.subreddit("test").flair.set("bboe", text="PRAW author", css_class="mods") template = "6bd28436-1aa7-11e9-9902-0e05ab0fad46" reddit.subreddit("test").flair.set( "spez", text="Reddit CEO", flair_template_id=template ) templates() praw.models.reddit.subreddit.SubredditRedditorFlairTemplates#

Provide an instance of SubredditRedditorFlairTemplates.

Use this attribute for interacting with a Subreddit’s flair templates. For example to list all the flair templates for a subreddit which you have the flair moderator permission on try:

for template in reddit.subreddit("test").flair.templates: print(template) update(flair_list:Iterator[str|praw.models.Redditor|Dict[str,str|praw.models.Redditor]], *, text:str='', css_class:str='') List[Dict[str,str|bool|Dict[str,str]]]#

Set or clear the flair for many redditors at once.

Parameters:
  • flair_list

    Each item in this list should be either:

    • The name of a redditor.

    • An instance of Redditor.

    • A dictionary mapping keys "user", "flair_text", and "flair_css_class" to their respective values. The "user" key should map to a redditor, as described above. When a dictionary isn’t provided, or the dictionary is missing either "flair_text" or "flair_css_class" keys, the default values will come from the other arguments.

  • css_class – The css class to use when not explicitly provided in flair_list (default: "").

  • text – The flair text to use when not explicitly provided in flair_list (default: "").

Returns:

List of dictionaries indicating the success or failure of each update.

For example, to clear the flair text, and set the "praw" flair css class on a few users try:

subreddit.flair.update(["bboe", "spez", "spladug"], css_class="praw") On this page
  • SubredditFlair
    • SubredditFlair
      • SubredditFlair.__call__()
      • SubredditFlair.__init__()
      • SubredditFlair.configure()
      • SubredditFlair.delete()
      • SubredditFlair.delete_all()
      • SubredditFlair.link_templates()
      • SubredditFlair.set()
      • SubredditFlair.templates()
      • SubredditFlair.update()

Tag » What Is Flair On Reddit