asyncprawcore follows semantic versioning.
Changed
- Make every public parameter either keyword-only or positional-only. The
requestor,authenticator, andauthorizersubjects of the authenticator and authorizer classes, the parameters of :class:`.Requestor`, :meth:`.Session.request`, and :meth:`.BaseAuthenticator.authorize_url`, theonly_accessargument of :meth:`.Authorizer.revoke`, and thesessionfactory are now keyword-only, while the single obvious operand of a method (such as thetokenargument of :meth:`.BaseAuthenticator.revoke_token`, thecodeargument of :meth:`.Authorizer.authorize`, and theresponseargument of the exception classes) is positional-only.
Removed
- The deprecated
loopargument of :class:`.Requestor`, which has been ignored since 2.5.0.
Added
- Support for Python 3.14.
- Add an
__all__to theasyncprawcorepackage to explicitly define its public API. - Add a
py.typedmarker (PEP 561) so that downstream projects can type check against asyncprawcore's inline annotations. - Add read-only :attr:`.Session.authorizer`, :attr:`.Session.rate_limiter`, and :attr:`.Session.requestor` properties, a :attr:`.BaseAuthorizer.authenticator` property, and a :attr:`.BaseAuthenticator.requestor` property, so that downstream code can reach these objects without accessing protected attributes.
- Add Sphinx-based documentation, published at https://asyncprawcore.readthedocs.io/.
Changed
- Improved exception message when
asyncio.TimeoutErroris raised. - Improve source docstrings and type annotations so that references render cleanly in the new documentation.
- Fixed type hinting for
dataandparamsinRequestor.request(). - Pass
filestoaiohttp.ClientSession.request()inRequestor.request()correctly again. - Widen the
authorizerparameter of :func:`.session` toBaseAuthorizerto match :class:`.Session`, so that passing an :class:`.ImplicitAuthorizer` or :class:`.DeviceIDAuthorizer` type checks. - Widen the
data,files,json, andparamsparameter annotations of :meth:`.Session.request` to reflect the values it already accepts at runtime (for example a non-dictdatabody, alistjsonpayload, and anyIOfile object), so that callers no longer need to cast these arguments.
Removed
- Support for Python 3.9, which is end-of-life on 2025-10-31.
Changed
- Improved type hinting.
Fixed
- Increase half-second delay introduced in
3.0.0to a full second delay.
Changed
- Session creation is now delayed and existing sessions will be reused.
- Drop support for Python 3.8, which was end-of-life on 2024-10-07.
- :class:`.RateLimiter` attribute
next_request_timestamphas been removed and replaced withnext_request_timestamp_ns.
Fixed
- Add a half-second delay when there are no more requests in the rate limit window and the window has zero seconds remaining to avoid a semi-rare case where Reddit will return a 429 response resulting in a :class:`.TooManyRequests` exception.
Removed
- Remove :class:`.RateLimiter` attribute
reset_timestamp.
Changed
- Drop support for Python 3.6, which was end-of-life on 2021-12-23.
- :class:`.DeviceIDAuthorizer` can be now used with :class:`.TrustedAuthenticator`.
- Updated rate limit algorithm to better handle Reddit's new rate limits.
- Drop support for Python 3.7, which was end-of-life on 2023-06-27.
Added
- 301 redirects result in a
Redirectexception. - :class:`.Requestor` is now initialized with a
timeoutparameter. - :class:`.ScriptAuthorizer`, :class:`.ReadOnlyAuthorizer`, and
:class:`.DeviceIDAuthorizer` have a new parameter,
scopes, which determines the scope of access requests. - Retry 408 "Request Timeout" HTTP responses.
Changed
- Cast non-string objects to string when preprocessing
dataandparams.
Added
- Support 202 "Accepted" HTTP responses.
Fixed
- The expected HTTP response status code for a request made with the proper credentials to api/v1/revoke_token has been changed from 204 to 200.
Added
- Add a :class:`.URITooLong` exception.
- :class:`.ScriptAuthorizer` has a new parameter
two_factor_callbackthat supplies OTPs (One-Time Passcodes) when :meth:`.ScriptAuthorizer.refresh` is called. - Add a :class:`.TooManyRequests` exception.
Fixed
- Fix
RuntimeWarningwhen executing pre/post refresh token callbacks.
Added
- :class:`.Authorizer` optionally takes a
pre_refresh_callbackkeyword argument. If provided, the function will called with the instance of :class:`.Authorizer` prior to refreshing the access and refresh tokens. - :class:`.Authorizer` optionally takes a
post_refresh_callbackkeyword argument. If provided, the function will called with the instance of :class:`.Authorizer` after refreshing the access and refresh tokens.
Changed
- The
refresh_tokenargument to :class:`.Authorizer` must now be passed by keyword, and cannot be passed as a positional argument.
Changed
- Improved preprocessing for
dataandparamsinSession.request().
Added
- :meth:`.Requestor.request` can be given a timeout parameter to control the amount of time to wait for a request to succeed.
Changed
- Added preprocessing for
dataandparamsinasyncprawcore.Session.request()for compatibility withaiohttp.
Fixed
:class:`.RateLimiter` will not sleep longer than next_request_timestamp.
Fixed
- Keys with a
Nonevalue in thedataorparamsparameters forasyncprawcore.Session.request()are now dropped asaiohttp.ClientSession.request()does not acceptNonevalues indataandparams. - Keys with a boolean value in the
paramsparameter forasyncprawcore.Session.request()are now casted to a string asaiohttp.ClientSession.request()does not accept boolean values inparams.
Fixed
- How files are handled.
datais now able to be passed withfilessince asyncpraw can make requests with both parameters. - Fixed
SpecialExceptionnot able to getresponse.json()since it is a coroutine.
Fixed
- Documentation errors.
authorize_urlwill correctly return astrinstead ofyarl.URL().
- Converted from
requeststoaiohttpfor asynchronous operation. - Updated upto version 1.4.0 of prawcore.
- Forked from praw-dev/prawcore