ListingGenerator is a utility class that fetches items from the listing endpoint, parses the response, and yields items as they are found.
If the item kind cannot be identified,
aPRAWBase is returned which automatically assigns itself all the data attributes found.
- class apraw.models.ListingGenerator(reddit: Reddit, endpoint: str, limit: int = 100, subreddit: Subreddit = None, kind_filter: List[str] = None, listing_class: Type[apraw.models.reddit.listing.Listing] = apraw.models.reddit.listing.Listing, **kwargs)¶
The model to request listings from Reddit.
- reddit: Reddit
- endpoint: str
The endpoint to make requests on.
- max_wait: int
The maximum amount of seconds to wait before re-requesting in streams.
Kinds to return if given, otherwise all are returned.
- subreddit: Subreddit
The subreddit to inject as a dependency into items if given.
ListingGenerator will automatically make requests until none more are found or the limit has been reached.