v8.0.0
Added
- :class:
.Announcementand :class:.AnnouncementHelper, exposed as
:attr:.Reddit.announcements, for listing, hiding, and marking the currently
authenticated user's announcements as read. Provides :meth:.Announcement.hide,
:meth:.Announcement.mark_read, :meth:.AnnouncementHelper.hide,
:meth:.AnnouncementHelper.mark_read, and :meth:.AnnouncementHelper.mark_all_read.
:attr:.Announcement.sent_datetimeand :attr:.Announcement.read_datetimereturn the
announcement'ssent_atandread_attimestamps as timezone-aware
:class:datetime.datetimeobjects (read_datetimeisNonefor unread
announcements). - :attr:
~.Comment.created_datetimeto objects with a creation time (for example
:class:.Comment, :class:.Submission, :class:.Redditor, :class:.Subreddit,
:class:.Collection, and :class:.ModNote), returning a timezone-aware
:class:datetime.datetime. - :attr:
~.Collection.updated_datetimeto :class:.Collection,
:attr:~.PollData.voting_end_datetimeto :class:.PollData, and
:attr:~.Comment.edited_datetimeto :class:.Commentand :class:.Submission
(Nonewhen the object has not been edited), all returning timezone-aware
:class:datetime.datetimeobjects. - An
exception_handlerkeyword argument to :func:.stream_generator(and thus all
streammethods) that is invoked with any exception raised while fetching items,
allowing the stream to resume rather than terminate. Re-raise from the handler to stop
the stream. - Warn when a
praw.iniin the current working directory sets theoauth_urlor
reddit_urlendpoint, as such a file can redirect credentials to an untrusted host.
The warning can be silenced by setting thePRAW_ALLOW_ENDPOINT_OVERRIDE
environment variable. - :meth:
.Redditor.overviewto iterate over a Redditor's combined comments and
submissions, mirroring the user overview page on Reddit. - Add support for Python 3.13.
- Add support for Python 3.14.
- Add support for optional Markdown-formatted
selftextwhen submitting link, image,
gallery and video posts. - Add :class:
.Mediaand its subclasses :class:.EmojiMedia, :class:.PostMedia,
:class:.StylesheetAsset, :class:.StylesheetImage, and :class:.WidgetMediato
consolidate media uploads. Media can be constructed from a file path, or from
bytescontent along with aname, so media no longer has to be written to disk
before uploading. - Support delayed session creation in asyncprawcore 2.5.0+.
- Add parameter
fetchto :meth:.get_ruleto control whether to fetch the rule data
when initializing the rule object. - A
py.typedmarker (:PEP:561) so that downstream projects can type check against
Async PRAW's inline annotations.
Changed
-
Drop support for Python 3.9, which was end-of-life on 2025-10-31.
-
Require
asyncprawcore >=3.1.0, <4for its public :class:!Sessionand authorizer
accessors and the widened :meth:!Session.requestannotations, which let Async PRAW
drop a number of internalcast\ s and type-checker suppressions. -
Require
update_checker[async] >=1.0, <2.0and perform the update check using its
native async API on the first request, instead of a blocking call duringReddit
initialization. The 1.0 release is dependency-free, droppingrequestsfrom Async
PRAW's transitive dependencies. -
Drop support for Python 3.8, which was end-of-life on 2024-10-07.
-
Change
Reddit.user.meto raise :class:.ReadOnlyExceptionwhen called in
:attr:.read_onlymode. -
The
subredditattribute of :class:.Redditoris a :class:.UserSubreddit
instance. -
The
dataargument toObjector.objectifymust now be passed by keyword. -
The
mark_readargument tosubreddit.modmail(:class:.ModmailConversation)
must now be passed by keyword. -
The
flair_typeargument to :class:.SubredditFlairTemplatesmust be passed by
keyword. -
The
selftextandurlarguments to :meth:.Subreddit.submitare no longer
mutually exclusive. Whenurlis providedselftextwill be used as optional
body text to accompany the link submission. An exception is raised when trying to use
inline_mediawithselftextfor aurlsubmission because Reddit does not
support inline media in body text for link submissions. -
Subreddit.submit_gallery,Subreddit.submit_image,Subreddit.submit_poll,
andSubreddit.submit_videohave been merged into :meth:.Subreddit.submit. The
kind of submission is selected with thegallery,image,poll,url, or
videokeyword argument. At least one of those, orselftext, must be provided,
and they are mutually exclusive, whileselftextmay accompany any of them as
optional Markdown-formatted body text.imagetakes a :class:.PostMediainstance;
gallerytakes a list of :class:.PostMediainstances ordict\ s with a
mediakey;videotakes a :class:.PostMediainstance or adictwith a
mediakey and optionalgifandthumbnailkeys; andpolltakes a
dictwithdurationandoptionskeys. -
Media upload methods now accept :class:
.Mediainstances instead of file paths:- The
image_pathargument to :meth:.SubredditEmoji.addhas been replaced by
media, which takes an :class:.EmojiMediainstance. - The
image_patharguments to the :class:.SubredditStylesheetupload_*
methods have been replaced bymedia, which must be passed positionally.
:meth:.SubredditStylesheet.upload, :meth:.SubredditStylesheet.upload_header,
:meth:.SubredditStylesheet.upload_mobile_header, and
:meth:.SubredditStylesheet.upload_mobile_icontake a :class:.StylesheetImage
instance, while :meth:.SubredditStylesheet.upload_banner,
:meth:.SubredditStylesheet.upload_banner_additional_image,
:meth:.SubredditStylesheet.upload_banner_hover_image, and
:meth:.SubredditStylesheet.upload_mobile_bannertake a :class:.StylesheetAsset
instance. - The
file_pathargument to :meth:.SubredditWidgetsModeration.upload_imagehas
been replaced bymedia, which takes a :class:.WidgetMediainstance and must be
passed positionally. - The
pathargument to :class:.InlineMedia(:class:.InlineGif,
:class:.InlineImage, and :class:.InlineVideo) has been replaced bymedia,
which takes a :class:.PostMediainstance.
- The
-
An unknown media type now raises :class:
.ClientExceptionwhen uploading media,
instead of falling back to JPEG. -
Media uploads to Reddit's S3 buckets now respect the configured
timeoutand raise
asyncprawcore.RequestExceptionon transport errors, consistent with all other
requests, instead of bypassing the configured timeout and raising rawaiohttp
exceptions. -
:meth:
.CommentForest.listno longer needs to be awaited. -
The keyword argument
lazyhas been replace byfetchto consolidate the keyword
argument used to explicitly perform a fetch when initializing an object. -
The argument
reason_idin :meth:.RemovalReason.__init__has been replaced with
idand is now a positional-only argument. -
The
nameargument in :meth:.get_emojiis now a positional-only argument. -
The
reason_idargument in :meth:.get_reasonhas been replaced withidand is
now a positional-only argument. -
The
short_nameargument in :meth:.get_ruleis now a positional-only argument. -
The
update_idargument in :meth:.get_updatehas been replaced withidand is
now a positional-only argument. -
The
page_nameargument in :meth:.get_pageis now a positional-only argument. -
The
fetchargument in the following methods is now a keyword-only argument:- :meth:
.get_emoji - :meth:
.get_reason - :meth:
.get_update - :meth:
.DraftHelper.__call__ - :meth:
.LiveHelper.__call__ - :meth:
.Modmail.__call__ - :meth:
.SubredditCollections.__call__ - :meth:
.SubredditHelper.__call__
- :meth:
-
:meth:
.Submission.add_fetch_paramnow raises :class:.ClientExceptionwhen called
on a submission that has already been fetched, rather than logging a warning, since
the added parameters would have no effect. -
The
comment_sortandcomment_limitattributes of a :class:.Submissionmust
now be set before the submission is fetched; setting either after the submission has
been fetched raises :class:.ClientExceptioninstead of logging a warning. Because
reddit.submission()fetches by default, initialize the submission with
fetch=False, set the attributes, then call :meth:~.Submission.load. -
Require
asyncprawcore >=4, <5. -
Split
asyncpraw/models/reddit/subreddit.pyinto an
asyncpraw.models.reddit.subredditpackage, with :class:.Subredditand each of
its helper classes (:class:.Modmail, :class:.SubredditFilters,
:class:.SubredditFlair, :class:.SubredditModeration,
:class:.SubredditQuarantine, :class:.SubredditRelationship,
:class:.SubredditStream, :class:.SubredditStylesheet, :class:.SubredditWiki, and
their related classes) moved to dedicated modules. All classes remain importable from
asyncpraw.models.reddit.subredditandasyncpraw.modelsfor backwards
compatibility. See the :ref:migration guide <asyncpraw8_migration>for the full
mapping.
Fixed
- An issue where submitting a gallery post with websockets enabled would fail.
- Fix API endpoint for :meth:
.Submission.hideand :meth:.Submission.unhide, which
returned a 404 due to a trailing slash. - Fix
TypeErrorwhen objectifying a response whosejson.errorsfield isnull
rather than an empty list (e.g.api/hide).
Removed
- The
warn_additional_fetch_paramsconfiguration option, which is obsolete now that
adding fetch parameters to an already-fetched submission raises
:class:.ClientException. - The
warn_comment_sortconfiguration option, which is obsolete now that setting
comment_sortorcomment_limitafter the comments have been fetched raises
:class:.ClientException. - Remove
Reddit.random_subreddit,Subreddit.random, and
Subreddit.random_rising. - Remove
APIExceptionclass. - Remove
PRAWExceptionclass rename handler. - Remove
Comment.awardandSubmission.awardmethods. - Remove
Comment.gild,Redditor.gild, andSubmission.gildmethods. - Remove
Redditor.gildedandSubreddit.gildedmethods. - Remove
Redditor.gildingsmethod. - Remove
Subreddit.mod.inbox,Subreddit.mod.unread, and
Subreddit.mod.stream.unreadmethods. - Remove
Subreddits.search_by_topicmethod. - Remove
Subreddits.goldmethod. - Remove :class:
.Redditkeyword argumenttoken_managerand all associated token
managers. - Remove
Reddit.validate_on_submitconfiguration attribute. - Remove
WebSocketException.original_exceptionmethod. - Remove the
afterargument for :meth:.conversations. - Remove ability to use :class:
.CommentForestas an asynchronous iterator. - Remove ability to use :class:
.Redditas an synchronous context manager. - Remove key
reset_timestampfrom :meth:.limits. - Remove
SubredditMessage.muteandSubredditMessage.unmutemethods. - Remove
InboxableMixin.unblock_subredditmethod.