reddit.live¶
- class asyncpraw.models.LiveHelper(reddit, _data)¶
Provide a set of functions to interact with
LiveThreads.- Parameters:
reddit (asyncpraw.Reddit)
- await __call__(id, *, fetch=False)¶
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:
- Return type:
- __init__(reddit, _data)¶
Initialize a
AsyncPRAWBaseinstance.
- await create(title, *, description=None, nsfw=False, resources=None)¶
Create a new
LiveThread.- Parameters:
title (
str) – The title of the newLiveThread.description (
str|None) – The newLiveThread’s description.nsfw (
bool) – Indicate whether this thread is not safe for work (default:False).resources (
str|None) – Markdown formatted information that is useful for theLiveThread.
- Return type:
- Returns:
The new
LiveThreadobject.
- info(ids)¶
Fetch information about each live thread in
ids.- Parameters:
- Return type:
- Returns:
A generator that yields
LiveThreadinstances.- Raises:
asyncprawcore.ServerErrorif 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()¶
Get the currently featured live thread.
- Return type:
- Returns:
The
LiveThreadobject, orNoneif there is no currently featured live thread.
Usage:
thread = await reddit.live.now() # LiveThread object or None