LiveThread¶
-
class
praw.models.
LiveThread
(reddit, id=None, _data=None)¶ An individual LiveThread object.
-
__getitem__
(update_id)¶ Return a lazy
LiveUpdate
instance.Warning
At this time, accessing lazy attributes, whose value have not loaded, raises
AttributeError
.Parameters: update_id – A live update ID, e.g., '7827987a-c998-11e4-a0b9-22000b6a88d2'
.Usage:
thread = reddit.live('ukaeu1ik4sw5') update = thread['7827987a-c998-11e4-a0b9-22000b6a88d2'] update.thread # LiveThread(id='ukaeu1ik4sw5') update.id # '7827987a-c998-11e4-a0b9-22000b6a88d2' update.author # raise ``AttributeError``
-
__init__
(reddit, id=None, _data=None)¶ Initialize a lazy
LiveThread
instance.Parameters: - reddit – An instance of
Reddit
. - id – A live thread ID, e.g.,
'ukaeu1ik4sw5'
- reddit – An instance of
-
contrib
¶ Provide an instance of
LiveThreadContribution
.Usage:
thread = reddit.live('ukaeu1ik4sw5') thread.contrib.add('### update')
-
contributor
¶ Provide an instance of
LiveContributorRelationship
.You can call the instance to get a list of contributors which is represented as
RedditorList
instance consists ofRedditor
instances. Those Redditor instances have permissions attributes as contributors:thread = reddit.live('ukaeu1ik4sw5') for contributor in thread.contributor(): # prints `(Redditor(name='Acidtwist'), [u'all'])` print(contributor, contributor.permissions)
-
discussions
(**generator_kwargs)¶ Get submissions linking to the thread.
Parameters: generator_kwargs – keyword arguments passed to ListingGenerator
constructor.Returns: A ListingGenerator
object which yieldsSubmission
object.Usage:
thread = reddit.live('ukaeu1ik4sw5') for submission in thread.discussions(limit=None): print(submission.title)
-
fullname
¶ Return the object’s fullname.
A fullname is an object’s kind mapping like t3 followed by an underscore and the object’s base36 ID, e.g., t1_c5s96e0.
-
parse
(data, reddit)¶ Return an instance of
cls
fromdata
.Parameters: - data – The structured data.
- reddit – An instance of
Reddit
.
-
report
(type)¶ Report the thread violating the Reddit rules.
Parameters: type – One of 'spam'
,'vote-manipulation'
,'personal-information'
,'sexualizing-minors'
,'site-breaking'
.Usage:
thread = reddit.live('xyu8kmjvfrww') thread.report('spam')
-
updates
(**generator_kwargs)¶ Return a
ListingGenerator
yieldsLiveUpdate
s.Parameters: generator_kwargs – keyword arguments passed to ListingGenerator
constructor.Returns: A ListingGenerator
object which yieldsLiveUpdate
object.Usage:
thread = reddit.live('ukaeu1ik4sw5') after = 'LiveUpdate_fefb3dae-7534-11e6-b259-0ef8c7233633' for submission in thread.updates(limit=5, params={'after': after}): print(submission.body)
-