MCPcopy Index your code
hub / github.com/praw-dev/praw / update

Method update

praw/models/reddit/draft.py:214–288  ·  view source on GitHub ↗

Update the :class:`.Draft`. .. note:: Only provided values will be updated. :param flair_id: The flair template to select. :param flair_text: If the template's ``flair_text_editable`` value is ``True``, this value will set a custom text. ``flair_id`

(
        self,
        *,
        flair_id: str | None = None,
        flair_text: str | None = None,
        is_public_link: bool | None = None,
        nsfw: bool | None = None,
        original_content: bool | None = None,
        selftext: str | None = None,
        send_replies: bool | None = None,
        spoiler: bool | None = None,
        subreddit: (str | models.Subreddit | models.UserSubreddit | None) = None,
        title: str | None = None,
        url: str | None = None,
        **draft_kwargs: Any,
    )

Source from the content-addressed store, hash-verified

212 return subreddit_.submit(**submit_kwargs)
213
214 def update(
215 self,
216 *,
217 flair_id: str | None = None,
218 flair_text: str | None = None,
219 is_public_link: bool | None = None,
220 nsfw: bool | None = None,
221 original_content: bool | None = None,
222 selftext: str | None = None,
223 send_replies: bool | None = None,
224 spoiler: bool | None = None,
225 subreddit: (str | models.Subreddit | models.UserSubreddit | None) = None,
226 title: str | None = None,
227 url: str | None = None,
228 **draft_kwargs: Any,
229 ) -> None:
230 """Update the :class:`.Draft`.
231
232 .. note::
233
234 Only provided values will be updated.
235
236 :param flair_id: The flair template to select.
237 :param flair_text: If the template's ``flair_text_editable`` value is ``True``,
238 this value will set a custom text. ``flair_id`` is required when
239 ``flair_text`` is provided.
240 :param is_public_link: Whether to enable public viewing of the draft before it
241 is submitted.
242 :param nsfw: Whether the draft should be marked NSFW.
243 :param original_content: Whether the submission should be marked as original
244 content.
245 :param selftext: The Markdown formatted content for a text submission draft. Use
246 ``None`` to make a title-only submission draft. ``selftext`` can not be
247 provided if ``url`` is provided.
248 :param send_replies: When ``True``, messages will be sent to the submission
249 author when comments are made to the submission.
250 :param spoiler: Whether the submission should be marked as a spoiler.
251 :param subreddit: The subreddit to create the draft for. This accepts a
252 subreddit display name, :class:`.Subreddit` object, or
253 :class:`.UserSubreddit` object.
254 :param title: The title of the draft.
255 :param url: The URL for a ``link`` submission draft. ``url`` can not be provided
256 if ``selftext`` is provided.
257
258 Additional keyword arguments can be provided to handle new parameters as Reddit
259 introduces them.
260
261 For example, to update the title of a draft do:
262
263 .. code-block:: python
264
265 draft = reddit.drafts("5f87d55c-e4fb-11eb-8965-6aeb41b0880e")
266 draft.update(title="New title")
267
268 """
269 if isinstance(subreddit, str):
270 subreddit = self._reddit.subreddit(subreddit)
271 data = self._prepare_data(

Callers 2

_prepare_dataMethod · 0.45
_fetchMethod · 0.45

Calls 4

_prepare_dataMethod · 0.95
putMethod · 0.80
subredditMethod · 0.45
_fetchMethod · 0.45

Tested by

no test coverage detected