SubredditCollections

class asyncpraw.models.reddit.collections.SubredditCollections(reddit: asyncpraw.Reddit, subreddit: asyncpraw.models.Subreddit, _data: Optional[Dict[str, Any]] = None)

Class to represent a Subreddit’s Collections.

Obtain an instance via:

subreddit = await reddit.subreddit("test")
subreddit.collections
await __call__(collection_id: Optional[str] = None, permalink: Optional[str] = None, fetch: bool = True, **kwargs)

Return the Collection with the specified ID.

Parameters
  • collection_id – The ID of a Collection (default: None).

  • permalink – The permalink of a collection (default: None).

  • fetch – Determines if Async PRAW will fetch the object (default: True).

Returns

The specified Collection.

Exactly one of collection_id or permalink is required.

Example usage:

subreddit = await reddit.subreddit("test")

uuid = "847e4548-a3b5-4ad7-afb4-edbfc2ed0a6b"
collection = await subreddit.collections(uuid)
print(collection.title)
print(collection.description)

permalink = "https://www.reddit.com/r/test/collection/" + uuid
collection = await subreddit.collections(permalink=permalink)
print(collection.title)
print(collection.description)

If you don’t need the object fetched right away (e.g., to utilize a class method) you can do:

subreddit = await reddit.subreddit("test", fetch=True)
collection = await subreddit.collections(uuid, fetch=False)
await collection.mod.add("submission_id")
__init__(reddit: asyncpraw.Reddit, subreddit: asyncpraw.models.Subreddit, _data: Optional[Dict[str, Any]] = None)

Initialize a SubredditCollections instance.

mod() asyncpraw.models.reddit.collections.SubredditCollectionsModeration

Get an instance of SubredditCollectionsModeration.

Provides create():

my_sub = await reddit.subreddit("test", fetch=True)
new_collection = await my_sub.collections.mod.create("Title", "desc")
classmethod parse(data: Dict[str, Any], reddit: asyncpraw.Reddit) Any

Return an instance of cls from data.

Parameters
  • data – The structured data.

  • reddit – An instance of Reddit.