Removal Reasons¶
This section details the usage of models that aid in fetching and managing subreddit removal reasons.
SubredditRemovalReasons¶
- class apraw.models.SubredditRemovalReasons(reddit: Reddit, subreddit: Subreddit)¶
A helper to aid in retrieving and adding removal reasons to a subreddit.
- async add(title: str, message: str) apraw.models.subreddit.removal_reasons.SubredditRemovalReason ¶
Add a removal reason to the subreddit’s list.
- Parameters
title (str) – The title under which this removal reason is saved.
message (str) – The message that is sent to author’s when the removal reason is used.
- Returns
reason – The newly created, and fetched, removal reason.
- Return type
- async get(item: Union[int, str]) apraw.models.subreddit.removal_reasons.SubredditRemovalReason ¶
Retrieve a removal reason based on its ID or index.
- Parameters
item (int or str) – The item’s ID or index.
- Returns
reason – The removal reason that was found in the list.
- Return type
- Raises
StopIteration – If no removal reason by the given ID was found.
IndexError – If the index given doesn’t exist in the list of removal reasons.
SubredditRemovalReason¶
- class apraw.models.SubredditRemovalReason(reddit: Reddit, subreddit: Subreddit, data: Dict)¶
The model representing subreddits.
- url: str
The API URL to this specific removal reason.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the
aPRAWBase
class and may vary depending on the status of the response and expected objects.Attribute
Description
message
The message for this removal reason that is sent to authors.
id
The ID of this removal reason.
title
The title of this removal reason in the subreddit.
- async delete() Any ¶
Delete this removal reason from the subreddit.
- Returns
response – The API endpoint raw response.
- Return type
Any
- async fetch()¶
Fetch the data for this removal reason. The
aPRAWBase
class will automatically update and/or add members returned by the API.
- async update(title: Optional[str] = None, message: Optional[str] = None) Any ¶
Update the title and/or message of this removal reason.
- Parameters
title (Optional[str]) – The updated title for this removal reason. If none is specified the original title will be reused.
message (Optional[str]) – The updated message for this removal reason. If none is specified the original message will be reused.
- Returns
response – The API endpoint raw response.
- Return type
Any