redditwarp.siteprocs.subreddit.SYNC
#
- class redditwarp.siteprocs.subreddit.SYNC.SubredditProcedures(client: Client)[source]#
Bases:
object
- get(idy: int | str) Subreddit | None [source]#
Get information about a potentially inaccessible subreddit.
- Parameters:
idy (Union[int, str]) –
- fetch(idy: int | str) Subreddit [source]#
Fetch information about a potentially inaccessible subreddit.
- Parameters:
idy (Union[int, str]) –
- Return type:
- Raises:
redditwarp.exceptions.OperationException –
The target subreddit is was not found.
The target subreddit is private or banned.
- get_by_name(name: str) Subreddit | None [source]#
Return information about a subreddit by name.
Returns
None
when the target subreddit is private or banned, or if the specified subreddit name contained invalid characters, or you specified the name of a special subreddit:all
,popular
,friends
,mod
.- Parameters:
name (str) – Subreddit name.
- Return type:
Optional
[Subreddit
]
- fetch_by_name(name: str) Subreddit [source]#
Return information about a subreddit by name.
Behaves similarly to
get_by_name()
.- Parameters:
name (str) – Subreddit name.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
private
:The target subreddit is private.
banned
:The target subreddit is banned.
redditwarp.http.exceptions.StatusCodeException –
302
:The subreddit does not exist.
404
:You specified the name of a special subreddit:
all
,popular
,friends
,mod
.The specified subreddit name was too long or contained invalid characters.
- get_potentially_inaccessible(idy: int | str) object | None [source]#
Get information about a potentially inaccessible subreddit.
- Parameters:
idy (Union[int, str]) –
- Returns:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
Optional
[object
]
- fetch_potentially_inaccessible(idy: int | str) object [source]#
Fetch information about a potentially inaccessible subreddit.
- Parameters:
idy (Union[int, str]) –
- Returns:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
Optional
[object
]
- Raises:
redditwarp.exceptions.NoResultException – The target subreddit is was not found.
- get_potentially_inaccessible_by_name(name: str) object | None [source]#
Get information about a potentially inacessible subreddit.
- Parameters:
name (str) –
- Returns:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
Optional
[object
]
- fetch_potentially_inaccessible_by_name(name: str) object [source]#
Fetch information about a potentially inacessible subreddit.
- Parameters:
name (str) –
- Returns:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
object
- Raises:
redditwarp.exceptions.NoResultException – The target subreddit is was not found.
- bulk_fetch_potentially_inaccessible(ids: Iterable[_YIntOrStr]) CallChunkChainingIterator[object] [source]#
Bulk fetch information about a potentially inacessible subreddits, by ID.
Any ID not found will be ignored.
- Parameters:
ids (Iterable[_YIntOrStr]) –
- Returns:
Iterator of:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
CallChunkChainingIterator
[object
]
- bulk_fetch_potentially_inaccessible_by_name(names: Iterable[str]) CallChunkChainingIterator[object] [source]#
Bulk fetch information about a potentially inacessible subreddits, by name.
Any name not found will be ignored.
- Parameters:
ids (Iterable[int]) –
- Returns:
Iterator of:
InaccessibleSubreddit
if the subreddit is private or banned.None
if the subreddit does not exist.
- Return type:
CallChunkChainingIterator
[object
]
- pull_new_comments(sr: str, amount: int | None = None) ImpartedPaginatorChainingIterator[LooseCommentListingPaginator, LooseComment] [source]#
Pull new comments from a subreddit.
- Parameters:
sr (str) –
amount (Optional[int]) –
- get_settings(sr: str) Mapping[str, Any] [source]#
Get the settings of a subreddit.
- Parameters:
sr (str) –
- Return type:
Mapping
[str
,Any
]
- Raises:
redditwarp.http.exceptions.StatusCodeException –
302
:The specified subreddit does not exist.
404
:There is no user context.
You don’t have permission to view this subreddit’s settings.
- update_settings(idy: int | str, settings: Mapping[str, JSON_ro]) None [source]#
Update a subreddit’s settings.
- Parameters:
idy (Union[int, str]) –
settings (
Mapping
[str
,JSON_ro
]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
SUBREDDIT_REQUIRED
:The specified subreddit does not exist.
MOD_REQUIRED
:The current user is not a moderator of the subreddit.
- subscribe_by_id(idy: int | str) None [source]#
Subscribe to a subreddit.
- Parameters:
idy (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The specified subreddit could not be accessed.
404
:The specified subreddit does not exist.
- subscribe_by_name(name: str) None [source]#
Subscribe to a subreddit.
- Parameters:
name (str) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
403
:The specified subreddit could not be accessed.
The specified subreddit was a special name such as
popular
,all
, orrandom
.
404
:The specified subreddit does not exist.
- unsubscribe_by_id(idy: int | str) None [source]#
Unsubscribe from a subreddit.
Behaves similarly to
subscribe_by_id()
.
- unsubscribe_by_name(name: str) None [source]#
Unsubscribe from a subreddit.
Behaves similarly to
subscribe_by_name()
.
- get_rules(sr: str) SubredditRules [source]#
Get a subreddit’s rules.
Example:
rules = client.p.subreddit.get_rules(SR) for i, rule in enumerate(rules, 1): print(f"{i}. {rule.short_name}\n{rule.description}\n")
- Parameters:
sr (str) –
- Return type:
- Raises:
redditwarp.http.exceptions.StatusCodeException –
404
:The specified subreddit could not be accessed.
- get_post_requirements(sr: str) Mapping[str, Any] [source]#
Get the post requirement settings of a subreddit.
- Parameters:
sr (str) –
- Return type:
Mapping
[str
,Any
]
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
SUBREDDIT_NOEXIST
:The specified subreddit does not exist.
SUBREDDIT_NO_ACCESS
:The specified subreddit is private or banned.
- search(query: str, amount: int | None = None) ImpartedPaginatorChainingIterator[SubredditSearchPaginator, Subreddit] [source]#
Search subreddits by name or description.
- Parameters:
query (str) –
amount (Optional[int]) –
- Return type:
ImpartedPaginatorChainingIterator
[SubredditSearchPaginator
,Subreddit
]
- search_names(name: str) Sequence[str] [source]#
List subreddit names that begin with a query string.
- Parameters:
name (str) –
- Return type:
Sequence
[str
]