SubredditHelper.__call__() got an unexpected keyword argument 'other_subreddits'
HaluanUskoa opened this issue · comments
Describe the Bug
Encountered this error when attempting to subscribe to multiple subreddits at once:
TypeError("SubredditHelper.call() got an unexpected keyword argument 'other_subreddits'")
The docs mention that the other_subreddits
parameter is accepted.
The Reddit docs also mention that the same parameter (called sr / sr_name
on their end) is still accepted.
However, praw/models/reddit/subreddit.py
and the error message above seem to indicate this has been deprecated within PRAW:
@_deprecate_args("other_subreddits")
def subscribe(self, *, other_subreddits: list[praw.models.Subreddit] | None = None):
"""Subscribe to the subreddit.
:param other_subreddits: When provided, also subscribe to the provided list of
subreddits.
For example, to subscribe to r/test:
.. code-block:: python
reddit.subreddit("test").subscribe()
"""
data = {
"action": "sub",
"skip_inital_defaults": True,
"sr_name": self._subreddit_list(
other_subreddits=other_subreddits, subreddit=self
),
}
self._reddit.post(API_PATH["subscribe"], data=data)
Desired Result
- Determine whether or not I'm doing something wrong.
- If not, determine whether this parameter has been deprecated within PRAW, and possibly have it added back since the Reddit API still seems to support it (unless it's been deprecated on their end but the docs don't reflect it yet).
Code to reproduce the bug
# Works
reddit.subreddit('pics').subscribe()
# Doesn't work
reddit.subreddit('pics', other_subreddits = ['funny', 'aww']).subscribe()
My code does not include sensitive credentials
- Yes, I have removed sensitive credentials from my code.
Relevant Logs
TypeError("SubredditHelper.__call__() got an unexpected keyword argument 'other_subreddits'")
This code has previously worked as intended
I'm not sure, I haven't used this code before.
Operating System/Environment
Windows 10
Python Version
3.12.0
PRAW Version
7.7.1
Links, references, and/or additional comments?
No response
However,
praw/models/reddit/subreddit.py
and the error message above seem to indicate this has been deprecated within PRAW:
The positional usage of other_subreddits
in .subscribe()
is deprecated not the parameter itself.
The .subscribe()
method you're referencing is where you need to pass in other_subreddits=["funny", "aww"]
like so:
reddit.subreddit('pics').subscribe(other_subreddits=["funny", "aww"])
Oh, duh! Thanks. Completely blanked on the fact that the parameter was listed for subscribe()
and not subreddit()
.
This issue is stale because it has been open for 30 days with no activity.
Remove the Stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stale for 30 days with no activity.