redditwarp.models.submission#

class redditwarp.models.submission.Submission(d: Mapping[str, Any])[source]#

Bases: DatamementoBase

class Me(d: Mapping[str, Any])[source]#

Bases: object

saved: bool#

Whether the current user has saved the post.

Value false if there is no user context.

reply_notifications: bool#

Whether an inbox message will be sent to you when the submission receives a new top-level comment.

Value true if you are not the author of the submission.

Value true if there is no user context.

voted: int#

Value 1 if upvoted, 0 if not voted on, -1 if downvoted.

hidden: bool#

Whether the current user has hidden the post.

Value false if there is not user context.

is_following_event: bool#

True if the submisison has event details and is being followed by the current user.

Value false if there is no user context.

class Author(d: Mapping[str, Any])[source]#

Bases: object

class AuthorFlair(d: Mapping[str, Any])[source]#

Bases: object

template_uuid: str | None#

The author’s flair template UUID.

Value is null if no flair template is being used.

text_mode: str#

Either text or richtext.

text: str#

The author’s flair text.

Check if the value is an empty string to tell if a flair is being used.

css_class: str#

The author’s flair CSS class.

When a flair template is being used, the value of this field will be that of the CSS class designated by the template. If the flair template does not specify a CSS class then the value will be an empty string.

bg_color: str#

A background color hex string. E.g., #46d160.

If a flair template is not being used then the value is an empty string.

If a flair template is being used and the background color is unset then the value is an empty string.

fg_color_scheme: str#

Either dark or light, or empty string.

Value is empty string if a flair template is not being used.

has_had_flair_assigned_before_in_subreddit: bool#

Because of quirks in the API, we can tell if the user has ever had a flair assigned before in the subreddit.

has_had_flair_css_class_assigned_before_in_subreddit_when_no_flair_template_assigned: bool#

Because of quirks in the API, we can tell if the user has ever had a flair CSS class assigned before in the subreddit. This only works if a flair template is not being used.

name: str#
id36: str#
idn: int#
id: int#
has_premium: bool#
flair: AuthorFlair#
class Subreddit(d: Mapping[str, Any])[source]#

Bases: object

id36: str#
idn: int#
id: int#
name: str#
openness: str#

Either: public, private, restricted, archived, employees_only, gold_only, gold_restricted, or user.

quarantined: bool#
subscriber_count: int#
class Moderation(d: Mapping[str, Any])[source]#

Bases: object

class Approved(d: Mapping[str, Any])[source]#

Bases: object

by: str#

Name of the moderator who approved this comment.

ut: int#
at: datetime#
class Removed(d: Mapping[str, Any])[source]#

Bases: object

by: str#

Name of the moderator who removed this comment.

ut: int#
at: datetime#
class Reports(d: Mapping[str, Any])[source]#

Bases: object

ignoring: bool#
num_reports: int#
mod_reports: Sequence[ModReport]#
user_reports: Sequence[UserReport]#
class RemovalReason(d: Mapping[str, Any])[source]#

Bases: object

by: str#
title: str#
note: str#
spam: bool#
approved: Approved | None#
removed: Removed | None#
reports: Reports#
removal_reason: RemovalReason | None#
class Event(d: Mapping[str, Any])[source]#

Bases: object

start_ut: int#
start_at: datetime#
end_ut: int#
end_at: datetime#
is_live: bool#
class Flair(d: Mapping[str, Any])[source]#

Bases: object

template_uuid: str | None#

The post flair template UUID.

Value is null if no flair template is being used.

text_mode: str#

Either text or richtext.

text: str#

The flair text.

css_class: str#

Post flair CSS class.

When a flair template is being used, the value of this field will be that of the CSS class designated by the template. If the flair template does not specify a CSS class then the value will be an empty string.

bg_color: str#

A background color hex string. E.g., #46d160.

If a flair template is not being used then the value is an empty string.

A post flair template background color cannot be unset unlike user flair templates.

fg_color_scheme: str#

Either dark or light, or empty string.

Value is empty string if a flair template is not being used.

class Reports(d: Mapping[str, Any])[source]#

Bases: object

ignoring: bool#
num_reports: int#
mod_reports: Sequence[ModReport]#
user_reports: Sequence[UserReport]#
class Edited(outer: Submission)[source]#

Bases: object

ut: int#
at: datetime#
id36: str#

The ID of the submission as a base 36 number.

idn: int#
id: int#
created_ut: int#

Unix timestamp of when the submission was made.

created_at: datetime#

When the submission was made.

title: str#
score: int#

The number of upvotes (minus downvotes).

score_hidden: bool#

Whether the score should be hidden.

comment_count: int#

The number of comments.

This should be treated as an estimation and may not match the number of actual visible comments. It could be higher or lower.

The URL of the submission, without the domain.

The URL of the submission.

is_edited: bool#

True if the submission was edited.

edited_ut: int#

Unix timestamp of when the submission was edited.

Value is 0 if is_edited is false.

edited_at: datetime#

When the submission was edited.

Value is datetime.min if is_edited is false.

edited: Submission.Edited | None#

Value non-None if the comment was edited.

upvote_ratio: float#
removal_category: str | None#

None if not removed.

If removed, possible values:

author, anti_evil_ops, community_ops, legal_operations, copyright_takedown, reddit, user, deleted, moderator, automod_filtered.

suggested_sort: str#

Either: confidence (best), new, old, top, qa, controversial, or live.

Value empty string if not set.

stickied: bool#
archived: bool#

Whether the post is archived.

Archived posts cannot be commented on, but the author can still edit the OP.

locked: bool#
in_contest_mode: bool#

Whether the post is in contest mode.

In contest mode, the comments are shown in a random order.

nsfw: bool#
spoiler: bool#
oc: bool#

Whether the post is marked as ‘original content’.

num_crossposts: int#

Crosspost count.

is_crosspostable: bool#

Whether the post can be crossposted.

Will be false if the post was removed or deleted.

is_robot_indexable: bool#

Whether search engines should index this submission.

Will be false if the post was removed or deleted.

is_poster_profile_pinned: bool#

Whether the post is pinned to the poster’s profile.

This attribute can only be true if the submission object was obtained through a user listing.

distinguished: str#

Either moderator or admin, or empty string.

Value empty string if not distinguished.

event: Submission.Event | None#

Attributes related to event metadata of the submission.

me: Submission.Me#

Attributes relating to the current user.

If there is no user context, these values contain nonsense.

subreddit: Submission.Subreddit#

Information related to the submission’s subreddit.

author_display_name: str#

The author’s username.

Possibly [removed] if the submission was removed or [deleted] if the submission was deleted by the author.

author: Submission.Author | None#

Information about the author.

Value is None if the submission was removed or deleted.

mod: Submission.Moderation | None#

Attributes relating to moderation.

Value is None if the current user is not a moderator of the subreddit.

flair: Submission.Flair#

Attributes related to the author’s flair.

reports: Submission.Reports | None#
class redditwarp.models.submission.LinkPost(d: Mapping[str, Any])[source]#

Bases: Submission

The URL linked to by the link post.

class redditwarp.models.submission.TextPost(d: Mapping[str, Any])[source]#

Bases: Submission

body: str#

The body text of the submission. In markdown format.

body_html: str#

The HTML of the submission.

class redditwarp.models.submission.GalleryPost(d: Mapping[str, Any])[source]#

Bases: Submission

class GalleryItem(id: 'int', media_id: 'str', caption: 'str', outbound_link: 'str')[source]#

Bases: object

id: int#
media_id: str#
caption: str#
gallery: Sequence[GalleryPost.GalleryItem]#
class redditwarp.models.submission.PollPost(d: Mapping[str, Any])[source]#

Bases: Submission

class redditwarp.models.submission.CrosspostSubmission(d: Mapping[str, Any])[source]#

Bases: Submission

property original: Submission | None#

Original submission of this crosspost.

Value None if the original submission is from a subreddit that is now banned and the submission is no longer accessible.

original_id36: str#

The ID36 of the original submission.

original_idn: int#

The ID of the original submission.

original_id: int#

Same as original_idn.

redditwarp.models.submission.CrossPost#

alias of CrosspostSubmission