Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# ListingGenerator

class praw.models.ListingGenerator(reddit: praw.Reddit, url: str, limit: int = 100, params: Optional[Dict[str, Union[str, int]]] = None)

  Instances of this class generate `RedditBase` instances.

  Warning

  This class should not be directly utilized. Instead, you will find a number of methods that return instances of the class here.

  __init__(reddit: praw.Reddit, url: str, limit: int = 100, params: Optional[Dict[str, Union[str, int]]] = None)

    Initialize a `ListingGenerator` instance.

    Parameters:

      - reddit – An instance of `Reddit`.

      - url – A URL returning a Reddit listing.

      - limit – The number of content entries to fetch. If `limit` is `None`, then fetch as many entries as possible. Most of Reddit’s listings contain a maximum of 1000 items, and are returned 100 at a time. This class will automatically issue all necessary requests (default: `100`).

      - params – A dictionary containing additional query string parameters to send with the request.

  __iter__() → Iterator[Any]

    Permit `ListingGenerator` to operate as an iterator.

  classmethod parse(data: Dict[str, Any], reddit: praw.Reddit) → Any

    Return an instance of `cls` from `data`.

    Parameters:

      - data – The structured data.

      - reddit – An instance of `Reddit`.