Submission¶
A Submission can either be instantiated by using its ID, or by going through subreddits:
submission = await reddit.submission("h7mna9")
sub = await reddit.redditor("aprawbot")
async for submission in sub.new():
print(submission)
-
class
apraw.models.Submission(reddit: Reddit, data: Dict, full_data: Dict = None, subreddit: apraw.models.subreddit.Subreddit = None, author: apraw.models.redditor.Redditor = None)¶ The model representing submissions.
- reddit: Reddit
- The
Redditinstance with which requests are made. - data: Dict
- The data obtained from the /about endpoint.
- mod: SubmissionModeration
- The
SubmissionModerationinstance to aid in moderating the submission. - kind: str
- The item’s kind / type.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Attributes are dynamically provided by the
aPRAWBaseclass and may vary depending on the status of the response and expected objects.Attribute Description all_awardingsA list of the awardings on the submission. allow_live_commentsWhether live comments have been enabled on this submission. approved_at_utcThe UTC timestamp of when the submission was approved. approved_byThe user that approved the submission. approvedWhether the submission has been approved by the moderators of the subreddit. archivedWhether the submission has been archived by Reddit. author_flair_background_colorThe submission author’s flair background color. author_flair_css_classThe submission’s author flair CSS class. author_flair_richtextThe submission’s author flair text. author_flair_template_idThe submission author’s flair template ID if applicable. author_flair_text_colorThe submission’s author flair text color if applicable. author_flair_textThe author’s flair text if applicable. author_flair_typeThe type of flair used by the submission’s author. author_fullnameThe author of the submission prepended with t2_.author_patreon_flairThe submission’s author Patreon flair. authorThe name of the submission’s Redditor. banned_at_utcThe UTC timestamp at which the author was banned. banned_bynullcan_gildWhether the logged-in user can gild the submission. can_mod_postWhether the logged-in user can modify the post. categoryThe submission’s category. clickedWhether the submission has been clicked by the logged-in user previously. content_categoriesThe content categories assigned to the submission. contest_modeWhether the moderators of the subreddit have enabled contest mode on the submission. created_utcThe parsed UTC datetimeon which the submission was made.createdThe timestamp of when the submission was posted. discussion_typenulldistinguishedThe type of distinguishment on the submission. domainThe domain of the submission. downsThe number of downvotes on the submission. editedWhether the submission has been edited by its author. gildedThe number of awards this submission has received. gildingsThe gild awards the submission has received. hiddenWhether the submission has been hidden by the logged-in user. hide_scoreWhether clients should hide the score from users. idThe submission’s ID. ignore_reportsWhether reports should be ignored on this submission.`` is_crosspostableWhether the submission can be crossposted to other subreddits. is_metaWhether the submission is a meta post. is_original_contentWhether the submission has been marked as original content. is_reddit_media_domainWhether the media has been uploaded to Reddit. is_robot_indexableWhether the submission can be indexed by robots. is_selfWhether the submission is a self post. is_videoWhether the submission is a video post. likesboollink_flair_background_colorThe submission’s flair background color. link_flair_css_classThe CSS class applied on the submission’s flair if applicable. link_flair_richtextThe submission’s flair text if applicable. link_flair_template_idThe submission’s flair template ID if applicable. link_flair_text_colorThe submission’s flair text color if applicable. link_flair_textThe submission’s flair text. link_flair_typeThe type of flair applied to the submission. lockedWhether the submission has been locked by the subreddit moderators. media_embedDictmedia_onlyWhether the submission only consists of media. medianullmod_noteModerator notes added to the submission. mod_reason_byThe moderator who added the removal reason if applicable. mod_reason_titleThe reason the submission has been removed by moderators if applicable. mod_reportsA list of moderator reports on the submission. nameThe ID of the submission prepended with t3_.no_followboolnum_commentsThe number of comments on the submission. num_crosspostsThe number of times the submission has been crossposted. num_reportsThe number of reports on the submission. over_18Whether the submission has been marked as NSFW. parent_whitelist_statusnullpermalinkThe submission’s permalink. pinnedWhether the submission has been pinned on the subreddit. pwlsnullquarantineWhether the submission was posted in a quarantined subreddit. removal_reasonThe submission’s removal reason if applicable. removedWhether the submission has been removed by the subreddit moderators. report_reasonsA list of report reasons on the submission. savedWhether the submission has been saved by the logged-in user. scoreThe overall submission vote score. secure_media_embedDictsecure_medianullselftext_htmlThe submission text as HTML. selftextThe submission’s selftext. send_repliesWhether the author of the submission will receive reply notifications. spamWhether the submission has been marked as spam. spoilerWhether the submission contains a spoiler. stickiedWhether the submission is stickied on the subreddit. subreddit_idThe subreddit’s ID prepended with t5_.subreddit_name_prefixedThe name of the subreddit the submission was posted on, prefixed with “r/”. subreddit_subscribersThe number of subscribers to the submission’s subreddit. subreddit_typeThe type of the subreddit the submission was posted on (public, restricted, private). subredditThe name of the subreddit on which the submission was posted. suggested_sortThe suggested sort method for comments. thumbnail_heightThe height of the submission’s thumbnail if applicable. thumbnail_widthThe width of the submission’s thumbnail if applicable. thumbnailA URL to the submission’s thumbnail if applicable. titleThe submission’s title. total_awards_receivedThe number of awards on the submission. upsThe number of upvotes on the submission. urlThe full URL of the submission. user_reportsA list of the user reports on the submission. view_countThe number of views on the submission. visitedWhether the logged-in user has visited the submission previously. whitelist_statusnullwlsnullNote
Many of these attributes are only available if the logged-in user has moderator access to the item.
-
clear_vote()¶ Clear user up- and downvotes on the item.
Returns: resp – The API response JSON. Return type: Dict
-
comments(reload=False, **kwargs) → AsyncIterator[apraw.models.comment.Comment]¶ Iterate through all the comments made in the submission.
This endpoint retrieves all comments found in the full data retrieved from the /r/{sub}/comments/{id} endpoint, as well as /api/morechildren.
morechildren()usually won’t need to be called by end users of aPRAW.Parameters: - reload (bool) –
Whether to force reload the data.
Warning
reloadandrefresharguments will be replaced by refreshables in future releases of aPRAW, as they are alpha features. - kwargs (**Dict) – Query parameters to append to the request URL.
Yields: comment (Comment) – A comment made in the submission.
- reload (bool) –
-
delete()¶ Delete the item.
Returns: resp – The API response JSON. Return type: Dict
-
downvote()¶ Downvote the item.
Returns: resp – The API response JSON. Return type: Dict
-
full_data() → Dict¶ Retrieve the submission’s full data from the /r/{sub}/comments/{id} endpoint.
Returns: full_data – The full data retrieved from the /r/{sub}/comments/{id} endpoint. Return type: Dict
-
hide()¶ Hide the item.
Returns: resp – The API response JSON. Return type: Dict
-
mark_nsfw()¶ Mark the item as NSFW.
Returns: resp – The API response JSON. Return type: Dict
-
morechildren(children) → List[apraw.models.comment.Comment]¶ Retrieves further comments made in the submission.
Parameters: children (List[str]) – A list of comment IDs to retrieve. Returns: comments – A list of the comments retrieved from the endpoint using their IDs. Return type: List[Comment]
-
save(category: str = '')¶ Save the item in a category.
Parameters: category (str, optional) – The category name. Returns: resp – The API response JSON. Return type: Dict
-
spoiler()¶ Mark the item as a spoiler.
Returns: resp – The API response JSON. Return type: Dict
-
subreddit() → apraw.models.subreddit.Subreddit¶ Retrieve the subreddit this item was made in as a
Subreddit.Returns: subreddit – The subreddit this item was made in. Return type: Subreddit
-
unhide()¶ Unhide the item.
Returns: resp – The API response JSON. Return type: Dict
-
unmark_nsfw()¶ Unmark the item as NSFW.
Returns: resp – The API response JSON. Return type: Dict
-
unsave()¶ Unsave the item.
Returns: resp – The API response JSON. Return type: Dict
-
unspoiler()¶ Unmark the item as a spoiler.
Returns: resp – The API response JSON. Return type: Dict
-
upvote()¶ Upvote the item.
Returns: resp – The API response JSON. Return type: Dict