How to use the praw.models.listing.generator.ListingGenerator function in praw

To help you get started, we’ve selected a few praw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github praw-dev / praw / praw / models / reddit / subreddit.py View on Github external
"""Return a ListingGenerator for unread moderator messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        See ``inbox`` for all messages.

        To print the mail in the unread modmail queue try:

        .. code:: python

           for message in reddit.subreddit('mod').mod.unread():
               print("From: {}, To: {}".format(message.author, message.dest))

        """
        return ListingGenerator(
            self.subreddit._reddit,
            API_PATH["moderator_unread"].format(subreddit=self.subreddit),
            **generator_kwargs
        )
github praw-dev / praw / praw / models / listing / mixins / base.py View on Github external
This method can be used like:

        .. code:: python

           reddit.domain('imgur.com').hot()
           reddit.multireddit('samuraisam', 'programming').hot()
           reddit.redditor('spez').hot()
           reddit.redditor('spez').comments.hot()
           reddit.redditor('spez').submissions.hot()
           reddit.subreddit('all').hot()

        """
        generator_kwargs.setdefault("params", {})
        url = _prepare(self, generator_kwargs, "hot")
        return ListingGenerator(self._reddit, url, **generator_kwargs)
github praw-dev / praw / praw / models / user.py View on Github external
:class:`.ListingGenerator`.

        .. note:: This method will return a maximum of 100 moderated
           subreddits, ordered by subscriber count. To retrieve more than
           100 moderated subreddits, please see :meth:`.Redditor.moderated`.

        Usage:

        .. code-block:: python

           for subreddit in reddit.user.moderator_subreddits():
               print(subreddit.display_name)


        """
        return ListingGenerator(
            self._reddit, API_PATH["my_moderator"], **generator_kwargs
        )
github praw-dev / praw / praw / models / redditors.py View on Github external
def search(self, query, **generator_kwargs):
        r"""Return a :class:`.ListingGenerator` of Redditors for ``query``.

        :param query: The query string to filter Redditors by.

        :returns :class:`.Redditor`\ s.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.
        """
        self._safely_add_arguments(generator_kwargs, "params", q=query)
        return ListingGenerator(
            self._reddit, API_PATH["users_search"], **generator_kwargs
        )
github praw-dev / praw / praw / models / reddit / live.py View on Github external
:param generator_kwargs: keyword arguments passed to
            :class:`.ListingGenerator` constructor.
        :returns: A :class:`.ListingGenerator` object which yields
            :class:`.Submission` object.

        Usage:

        .. code-block:: python

           thread = reddit.live('ukaeu1ik4sw5')
           for submission in thread.discussions(limit=None):
               print(submission.title)

        """
        url = API_PATH["live_discussions"].format(id=self.id)
        return ListingGenerator(self._reddit, url, **generator_kwargs)
github praw-dev / praw / praw / models / subreddits.py View on Github external
def default(self, **generator_kwargs):
        """Return a :class:`.ListingGenerator` for default subreddits.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.
        """
        return ListingGenerator(
            self._reddit, API_PATH["subreddits_default"], **generator_kwargs
        )
github praw-dev / praw / praw / models / listing / mixins / gilded.py View on Github external
def gilded(self, **generator_kwargs):
        """Return a :class:`.ListingGenerator` for gilded items.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        """
        return ListingGenerator(
            self._reddit, urljoin(self._path, "gilded"), **generator_kwargs
        )
github praw-dev / praw / praw / models / subreddits.py View on Github external
def popular(self, **generator_kwargs):
        """Return a :class:`.ListingGenerator` for popular subreddits.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.
        """
        return ListingGenerator(
            self._reddit, API_PATH["subreddits_popular"], **generator_kwargs
        )
github praw-dev / praw / praw / models / redditors.py View on Github external
def popular(self, **generator_kwargs):
        """Return a :class:`.ListingGenerator` for popular Redditors.

        :returns Redditor profiles, which are a type of :class:`.Subreddit`.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.
        """
        return ListingGenerator(
            self._reddit, API_PATH["users_popular"], **generator_kwargs
        )
github praw-dev / praw / praw / models / listing / mixins / rising.py View on Github external
def random_rising(self, **generator_kwargs):
        """Return a :class:`.ListingGenerator` for random rising submissions.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        """
        return ListingGenerator(
            self._reddit,
            urljoin(self._path, "randomrising"),
            **generator_kwargs
        )