reddit.drafts¶
- class praw.models.DraftHelper(reddit, _data)¶
Provide a set of functions to interact with
Draftinstances.Note
The methods provided by this class will only work on the currently authenticated user’s
Drafts.- Parameters:
reddit (praw.Reddit)
- __call__(draft_id=None)¶
Return a list of
Draftinstances.- Parameters:
draft_id (
str|None) – When provided, this returns aDraftinstance (default:None).- Return type:
- Returns:
A
Draftinstance ifdraft_idis provided. Otherwise, a list ofDraftobjects.
Note
Drafts fetched using a specific draft ID are lazily loaded, so you might have to access an attribute to get all the expected attributes.
This method can be used to fetch a specific draft by ID, like so:
draft_id = "124862bc-e1e9-11eb-aa4f-e68667a77cbb" draft = reddit.drafts(draft_id) print(draft)
- create(*, flair_id=None, flair_text=None, is_public_link=False, nsfw=False, original_content=False, selftext=None, send_replies=True, spoiler=False, subreddit=None, title=None, url=None, **draft_kwargs)¶
Create a new
Draft.- Parameters:
flair_id (
str|None) – The flair template to select (default:None).flair_text (
str|None) – If the template’sflair_text_editablevalue isTrue, this value will set a custom text (default:None).flair_idis required whenflair_textis provided.is_public_link (
bool) – Whether to enable public viewing of the draft before it is submitted (default:False).nsfw (
bool) – Whether the draft should be marked NSFW (default:False).original_content (
bool) – Whether the submission should be marked as original content (default:False).selftext (
str|None) – The Markdown formatted content for a text submission draft. UseNoneto make a title-only submission draft (default:None).selftextcan not be provided ifurlis provided.send_replies (
bool) – WhenTrue, messages will be sent to the submission author when comments are made to the submission (default:True).spoiler (
bool) – Whether the submission should be marked as a spoiler (default:False).subreddit (
str|Subreddit|UserSubreddit|None) – The subreddit to create the draft for. This accepts a subreddit display name,Subredditobject, orUserSubredditobject. IfNone, theUserSubredditof currently authenticated user will be used (default:None).title (
str|None) – The title of the draft (default:None).url (
str|None) – The URL for alinksubmission draft (default:None).urlcan not be provided ifselftextis provided.draft_kwargs (Any)
- Return type:
Additional keyword arguments can be provided to handle new parameters as Reddit introduces them.
- Return type:
- Returns:
The new
Draftobject.- Parameters: