reddit.live¶
- class asyncpraw.models.LiveHelper(reddit: asyncpraw.Reddit, _data: dict[str, Any] | None)¶
Provide a set of functions to interact with
LiveThread
s.- await __call__(id: str, fetch: bool = False) asyncpraw.models.LiveThread ¶
Return a new instance of
LiveThread
.This method is intended to be used as:
livethread = await reddit.live("ukaeu1ik4sw5")
If you need the object fetched right away (e.g., to access attributes) you can do:
livethread = await reddit.live("ukaeu1ik4sw5", fetch=True) await livethread.close()
- Parameters:
id – A live thread ID, e.g.,
ukaeu1ik4sw5
.fetch – Determines if Async PRAW will fetch the object (default:
False
).
- __init__(reddit: asyncpraw.Reddit, _data: dict[str, Any] | None)¶
Initialize a
AsyncPRAWBase
instance.- Parameters:
reddit – An instance of
Reddit
.
- await create(title: str, *, description: str | None = None, nsfw: bool = False, resources: str = None) asyncpraw.models.LiveThread ¶
Create a new
LiveThread
.- Parameters:
title – The title of the new
LiveThread
.description – The new
LiveThread
’s description.nsfw – Indicate whether this thread is not safe for work (default:
False
).resources – Markdown formatted information that is useful for the
LiveThread
.
- Returns:
The new
LiveThread
object.
- info(ids: list[str]) AsyncGenerator[asyncpraw.models.LiveThread, None] ¶
Fetch information about each live thread in
ids
.- Parameters:
ids – A list of IDs for a live thread.
- Returns:
A generator that yields
LiveThread
instances.- Raises:
asyncprawcore.ServerError
if invalid live threads are requested.
Requests will be issued in batches for each 100 IDs.
Note
This method doesn’t support IDs for live updates.
Warning
Unlike
Reddit.info()
, the output of this method may not reflect the order of input.Usage:
ids = ["3rgnbke2rai6hen7ciytwcxadi", "sw7bubeycai6hey4ciytwamw3a", "t8jnufucss07"] async for thread in reddit.live.info(ids): print(thread.title)
- await now() asyncpraw.models.LiveThread | None ¶
Get the currently featured live thread.
- Returns:
The
LiveThread
object, orNone
if there is no currently featured live thread.
Usage:
thread = await reddit.live.now() # LiveThread object or None
- classmethod parse(data: dict[str, Any], reddit: asyncpraw.Reddit) AsyncPRAWBase ¶
Return an instance of
cls
fromdata
.- Parameters:
data – The structured data.
reddit – An instance of
Reddit
.