redditwarp.siteprocs.account.SYNC
#
- class redditwarp.siteprocs.account.SYNC.AccountProcedures(client: Client)[source]#
Bases:
object
- pull_subreddits: PullSubreddits#
Pull subreddits the current user is a member of.
- fetch() MyAccount [source]#
Fetch information about the currently logged in user.
- Return type:
- Raises:
redditwarp.exceptions.OperationException – There is no user context.
- get_preferences() Mapping[str, Any] [source]#
Retrieve the current user’s preferences.
- Return type:
Mapping
[str
,Any
]
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- set_preferences(prefs: Mapping[str, JSON_ro]) Mapping[str, Any] [source]#
Update the current user’s preferences.
- Parameters:
prefs (
Mapping
[str
,JSON_ro
]) – See the API docs for available preference settings: https://www.reddit.com/dev/api/#PATCH_api_v1_me_prefs.
- Returns:
The updated preferences, as you would get from
get_preferences()
.- Return type:
Mapping
[str
,Any
]
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- karma_breakdown() Sequence[KarmaBreakdownEntry] [source]#
Get the current user’s karma breakdown by subreddit.
The entries are sorted in descending order by comment karma plus submission karma.
- Return type:
Sequence
[KarmaBreakdownEntry
]
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- trophies() Sequence[Trophy] [source]#
Get a list of trophies for the current user.
- Return type:
Sequence
[Trophy
]
..RAISES
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- list_friends() Sequence[UserRelationship] [source]#
Get a list of friends.
- Return type:
Sequence
[UserRelationship
]
- Raises:
redditwarp.exceptions.OperationException – There is no user context.
- get_friend(name: str) UserRelationship [source]#
Get information about a specific ‘friend’.
This is an old reddit feature. See https://www.reddit.com/prefs/friends/.
- Parameters:
name (str) – The name of a user.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
NOT_FRIEND
:You are not friends with the specified user.
USER_DOESNT_EXIST
:The specified user does not exist.
- add_friend(name: str, note: str | None = None) FriendRelationship [source]#
Create or update a friend relationship.
Also use this function to add or update a note. Note: making a note requires Reddit Premium.
- Parameters:
name (str) – The name of a user.
note (Optional[str]) –
Add or update a note.
Using this parameter requires Reddit Premium, otherwise a
GOLD_REQUIRED
API error will occur.
- Returns:
The updated user object on success.
- Return type:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
USER_DOESNT_EXIST
:The specified user does not exist.
GOLD_REQUIRED
:You tried to add a note but you don’t have Reddit Premium.
NO_TEXT
:An empty string was specified for
note
.
- remove_friend(name: str) None [source]#
Remove a friend.
- Parameters:
name (str) – The name of a user.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
NOT_FRIEND
:The user specified is not a friend.
- list_blocked_users() Sequence[UserRelationship] [source]#
Get a list of blocked users.
- Return type:
Sequence
[UserRelationship
]
- Raises:
redditwarp.exceptions.OperationException – There is no user context.
- block_user_by_id(idy: int | str) None [source]#
Block a user by ID.
- Parameters:
idy (int | str) – The ID of the user to block.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
400
:The username or user ID given doesn’t exist.
You tried to block yourself.
- block_user_by_name(name: str) None [source]#
Block a user by name.
- Parameters:
name (str) –
- Return type:
None
- (raises):
(Same as in
block_user_by_id()
.)
- unblock_user_by_target_id(target_id: int | str, agent_id: int | str) None [source]#
Unblock a user by ID.
- Parameters:
target_id (int | str) – The user ID in which to unblock.
agent_id (int | str) –
Your user account’s ID.
The endpoint needs this information for some dumb reason.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
400
:The target username or target user ID doesn’t exist.
- unblock_user_by_target_name(target_name: str, agent_id: int | str) None [source]#
Unblock a user by name.
Behaves similarly to
unblock_user_by_target_id()
.- Parameters:
target_name (str) – The username in which to unblock.
agent_id (int | str) –
Your user account’s ID.
The endpoint needs this information for some dumb reason.
- Return type:
None
- (raises):
- list_trusted_users() Sequence[UserRelationship] [source]#
Get a list of trusted users.
Behaves similarly to
blocked()
.- Return type:
Sequence
[UserRelationship
]
- (raises):
See
blocked()
.
- add_trusted_user(name: str) None [source]#
Add a user to your trusted users list.
- Parameters:
name (str) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
CANT_WHITELIST_AN_ENEMY
:The specified user is on your blocked list.
USER_DOESNT_EXIST
:The specified user does not exist.
- remove_trusted_user(name: str) None [source]#
Remove a user from your trusted users list.
- Parameters:
name (str) – The target user name.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED
:There is no user context.
- get_blocked_and_trusted_users() tuple[Sequence[UserRelationship], Sequence[UserRelationship]] [source]#
Return the blocked and trusted user lists in one call.
Behaves similarly to
blocked()
.- Returns:
A tuple of two lists: the first list contains blocked users, the second list contains trusted’s users.
- Return type:
tuple
[Sequence
[UserRelationship
],Sequence
[UserRelationship
]]
- (raises):
See
blocked()
.