Return notes for this :class:`.Redditor` from one or more subreddits. :param subreddits: One or more subreddits to retrieve the notes from. Must be either a :class:`.Subreddit` or a subreddit name. :param all_notes: Whether to return all notes or only the latest note (de
(
self,
*subreddits: Subreddit | str,
all_notes: bool | None = None,
**generator_kwargs: Any,
)
| 536 | self.redditor = redditor |
| 537 | |
| 538 | def subreddits( |
| 539 | self, |
| 540 | *subreddits: Subreddit | str, |
| 541 | all_notes: bool | None = None, |
| 542 | **generator_kwargs: Any, |
| 543 | ) -> Iterator[models.ModNote]: |
| 544 | """Return notes for this :class:`.Redditor` from one or more subreddits. |
| 545 | |
| 546 | :param subreddits: One or more subreddits to retrieve the notes from. Must be |
| 547 | either a :class:`.Subreddit` or a subreddit name. |
| 548 | :param all_notes: Whether to return all notes or only the latest note (default: |
| 549 | ``True`` if only one subreddit is provided otherwise ``False``). |
| 550 | |
| 551 | .. note:: |
| 552 | |
| 553 | Setting this to ``True`` will result in a request for each subreddit. |
| 554 | |
| 555 | |
| 556 | :returns: A generator that yields the most recent :class:`.ModNote` (or ``None`` |
| 557 | if this redditor doesn't have any notes) per subreddit in their relative |
| 558 | order. If ``all_notes`` is ``True``, this will yield all notes or ``None`` |
| 559 | from each subreddit for this redditor. |
| 560 | |
| 561 | For example, all the notes for u/spez in r/test can be iterated through like so: |
| 562 | |
| 563 | .. code-block:: python |
| 564 | |
| 565 | redditor = reddit.redditor("spez") |
| 566 | |
| 567 | for note in redditor.notes.subreddits("test"): |
| 568 | print(f"{note.label}: {note.note}") |
| 569 | |
| 570 | For example, the latest note for u/spez from r/test and r/redditdev can be |
| 571 | iterated through like so: |
| 572 | |
| 573 | .. code-block:: python |
| 574 | |
| 575 | redditor = reddit.redditor("spez") |
| 576 | subreddit = reddit.subreddit("redditdev") |
| 577 | |
| 578 | for note in redditor.notes.subreddits("test", subreddit): |
| 579 | print(f"{note.label}: {note.note}") |
| 580 | |
| 581 | For example, **all** the notes for u/spez in r/test and r/redditdev can be |
| 582 | iterated through like so: |
| 583 | |
| 584 | .. code-block:: python |
| 585 | |
| 586 | redditor = reddit.redditor("spez") |
| 587 | subreddit = reddit.subreddit("redditdev") |
| 588 | |
| 589 | for note in redditor.notes.subreddits("test", subreddit, all_notes=True): |
| 590 | print(f"{note.label}: {note.note}") |
| 591 | |
| 592 | """ |
| 593 | if len(subreddits) == 0: |
| 594 | msg = "At least 1 subreddit must be provided." |
| 595 | raise ValueError(msg) |