LiveUpdate

class praw.models.LiveUpdate(reddit, thread_id=None, update_id=None, _data=None)

An individual LiveUpdate object.

Warning

At this time, accessing lazy attributes on this class may raises AttributeError: if an update is instantiated through LiveThread.updates(), the exception is not thrown. For example:

thread = reddit.live('xyu8kmjvfrww')
for update in thread.updates(limit=None):
    if update.id == 'cb5fe532-dbee-11e6-9a91-0e6d74fabcc4':
        print(update.stricken)  # True
        break

But the update is instantiated through thread[update_id] or LiveUpdate(reddit, update_id), AttributeError is thrown:

thread = reddit.live('xyu8kmjvfrww')
update = thread['cb5fe532-dbee-11e6-9a91-0e6d74fabcc4']
update.stricken  # raise AttributeError
__init__(reddit, thread_id=None, update_id=None, _data=None)

Initialize a lazy LiveUpdate instance.

Either thread_id and update_id, or _data must be provided.

Warning

At this time, accessing lazy attributes, whose value have not loaded, raises AttributeError. See LiveUpdate for details.

Parameters:
  • reddit – An instance of Reddit.
  • thread_id – A live thread ID, e.g., 'ukaeu1ik4sw5'.
  • update_id – A live update ID, e.g., '7827987a-c998-11e4-a0b9-22000b6a88d2'.

Usage:

update = LiveUpdate(reddit, 'ukaeu1ik4sw5',
                    '7827987a-c998-11e4-a0b9-22000b6a88d2')
update.thread     # LiveThread(id='ukaeu1ik4sw5')
update.id         # '7827987a-c998-11e4-a0b9-22000b6a88d2'
update.author     # raise ``AttributeError``
contrib

Provide an instance of LiveUpdateContribution.

Usage:

thread = reddit.live('ukaeu1ik4sw5')
update = thread['7827987a-c998-11e4-a0b9-22000b6a88d2']
update.contrib  # LiveUpdateContribution instance
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 from data.

Parameters:
  • data – The structured data.
  • reddit – An instance of Reddit.
thread

Return LiveThread object the update object belongs to.