Announcement¶
- class praw.models.Announcement(reddit, id=None, _data=None)¶
A class that represents a Reddit announcement.
Typical Attributes
Note
This table describes attributes that typically belong to objects of this class. PRAW dynamically provides the attributes that Reddit returns via the API. Since those attributes are subject to change on Reddit’s end, PRAW makes no effort to document any new/removed/changed attributes, other than to instruct you on how to discover what is available. As a result, this table of attributes may not be complete. See Determine Available Attributes of an Object for detailed information.
If you would like to add an attribute to this table, feel free to open a pull request.
Attribute
Description
body_htmlThe announcement’s body, rendered as HTML.
bodyThe announcement’s body, in Markdown.
idThe fullname of the announcement, e.g.
'ann_4sc833'.permalinkThe announcement’s permalink (to view on the web).
read_atTimestamp the announcement was read, in ISO-8601 format.
Noneif the announcement has not been read.read_datetimeread_atas a timezone-awaredatetime.datetime, orNoneif the announcement has not been read.sent_atTimestamp the announcement was sent, in ISO-8601 format.
sent_datetimesent_atas a timezone-awaredatetime.datetime.subjectThe subject line of the announcement.
- Parameters:
reddit (praw.Reddit)
id (str | None)
- __init__(reddit, id=None, _data=None)¶
Initialize an
Announcementinstance.
- property fullname: str¶
Return the object’s fullname.
A fullname is an object’s kind mapping like
t3followed by an underscore and the object’s base36 ID, e.g.,t1_c5s96e0.
- hide()¶
Hide the announcement.
Example usage:
for announcement in reddit.announcements(): announcement.hide()
See also
AnnouncementHelper.hide()to hide multiple announcements at once.- Return type:
- mark_read()¶
Mark the announcement as read.
Example usage:
for announcement in reddit.announcements(): if announcement.read_at is None: announcement.mark_read()
See also
AnnouncementHelper.mark_read()to mark multiple announcements as read at once.AnnouncementHelper.mark_all_read()to mark all announcements as read.
- Return type:
- classmethod parse(data, reddit)¶
Return an instance of
clsfromdata.
- property read_datetime: datetime | None¶
Return the time the announcement was read as a timezone-aware
datetime.datetime.Returns
Noneif the announcement has not been read. The returned object is localized to the system’s timezone.
- property sent_datetime: datetime¶
Return the time the announcement was sent as a timezone-aware
datetime.datetime.The returned object is localized to the system’s timezone.