prawcore follows semantic versioning.
Added
- 301 redirects result in a
Redirect
exception. Requestor
is now initialzed with atimeout
parameter.ScriptAuthorizer
,ReadOnlyAuthorizer
, andDeviceIDAuthorizer
have a new parameter,scopes
, which determines the scope of access requests.
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
URITooLarge
exception. - :class:`.ScriptAuthorizer` has a new parameter
two_factor_callback
that supplies OTPs (One-Time Passcodes) when :meth:`.ScriptAuthorizer.refresh` is called. - Add a
TooManyRequests
exception.
Added
Authorizer
optionally takes apre_refresh_callback
keyword argument. If provided, the function will called with the instance ofAuthorizer
prior to refreshing the access and refresh tokens.Authorizer
optionally takes apost_refresh_callback
keyword argument. If provided, the function will called with the instance ofAuthorizer
after refreshing the access and refresh tokens.
Changed
- The
refresh_token
argument toAuthorizer
must now be passed by keyword, and cannot be passed as a positional argument.
Changed
- Drop support for Python 3.5, which is end-of-life on 2020-09-13.
Added
- When calling :meth:`.Session.request`, we add the key-value pair
"api_type": "json"
to thejson
parameter, if it is adict
.
Changed
- (Non-breaking) Requests to
www.reddit.com
use theConnection: close
header to avoid warnings when tokens are refreshed after their one-hour expiration.
Added
- All other requestor methods, most notably :meth:`.Session.request`, now contain a
timeout
parameter.
Added
- Method
Requestor.request
can be given a timeout parameter to control the amount of time to wait for a request to succeed.
Changed
- Updated rate limit algorithm to more intelligently rate limit when there are extra requests remaining.
Removed
- Drop python 2.7 support.
Fixed
RateLimiter
will not sleep longer thannext_request_timestamp
.
I am releasing 1.0.0 as prawcore is quite stable and it's unlikely that any breaking changes will need to be introduced in the near future.
Added
- Log debug messages for all sleep times.
Added
SpecialError
is raised on HTTP 415.
Added
ReadTimeout
is automatically retried like the server errors.
Removed
- Removed support for Python 3.3 as it is no longer supported by requests.
Added
UnavailableForLegalReasons
exception raised when HTTP Response 451 is encountered.
Added
BadJSON
exception for the rare cases that a response that should contain valid JSON has unparsable JSON.
Added
Conflict
exception is raised when response status 409 is returned.
Fixed
InvalidToken
is again raised on 401 when a non-refreshable application is in use.
Added
ConnectionError
exceptions are automatically retried. This handlesConnection Reset by Peer
issues that appear to occur somewhat frequently when running on Amazon EC2.
Changed
- Calling
RateLimiter
now requires a second positional argument,set_header_callback
. - In the event a 401 unauthorized occurs, the access token is cleared and the request is retried.
Fixed
- Check if the access token is expired immediately before every authorized request, rather than just before the request flow. This new approach accounts for failure retries, and rate limiter delay.
Added
- Add
session
parameter to Requestor to ease support of custom sessions (e.g. caching or mock ones).
Added
- Handle 413 Request entity too large responses.
reset_timestamp
toRateLimiter
.
Fixed
- Avoid modifying passed in
data
andparams
toSession.request
.
Added
ChunkedEncodingError
is automatically retried like the server errors.
Added
- Handle 500 responses.
- Handle Cloudflare 520 responses.
Added
All network requests now have a 16 second timeout by default. The environment variable
prawcore_timeout
can be used to adjust the value.
Changed
- Prevent '(None)' from appearing in OAuthException message.
Added
- Add
files
parameter toSession.request
to support image upload operations. - Add
duration
andimplicit
parameters toUntrustedAuthenticator.authorization_url
so that the method also supports the code grant flow.
Fixed
Authorizer
class can be used withUntrustedAuthenticator
.
Fixed
session
works withDeviceIDAuthorizer
andImplicitAuthorizer
.
Added
- Add
ImplicitAuthorizer
.
Changed
- Split
Authenticator
intoTrustedAuthenticator
andUntrustedAuthenticator
.
Added
- Add
DeviceIDAuthorizer
that permits installed application access to the API.
Added
RequestException
which wraps all exceptions that occur fromrequests.request
in aprawcore.RequestException
.
Changed
- What was previously
RequestException
is nowResponseException
.
Added
- Handle Cloudflare 522 responses.
Added
- Add
ServerError
exception for 502, 503, and 504 HTTP status codes that is only raised after three failed attempts to make the request. - Add
json
parameter toSession.request
.
Added
- Automatically attempt to refresh access tokens when making a request if the access token is expired.
Fixed
- Consider access tokens expired slightly earlier than allowed for to prevent InvalidToken exceptions from occuring.
Added
- Handle 0-byte HTTP 200 responses.
Added
- Add a
NotFound
exception. - Support 404 "Not Found" HTTP responses.
Added
- Add a
BadRequest
exception. - Support 400 "Bad Request" HTTP responses.
- Support 204 "No Content" HTTP responses.
Added
- Support 201 "Created" HTTP responses used in some v1 endpoints.
Added
- Sort
Session.request
data
values. Sorting the values permits betamax body matcher to work as expected.
Added
- Added
data
parameter toSession.request
.
Fixed
- prawcore objects can be pickled.
Added
- 302 redirects result in a
Redirect
exception.
Added
- Add a generic
Forbidden
exception for 403 responses without thewww-authenticate
header.
Added
- Added
params
parameter toSession.request
. - Log requests to the
prawcore
logger in debug mode.
Fixed
- README.rst for display purposes on pypi.
Added
- Dynamic rate limiting based on reddit's response headers.
- Authorization URL generation.
- Retrieval of access and refresh tokens from authorization grants.
- Access and refresh token revocation.
- Retrieval of read-only access tokens.
- Retrieval of script-app tokens.
- Three examples in the
examples/
directory.