You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In torfsen/roux-stream#12, a user's code crashed with hard-to-understand error messages that originated from Serde not being able to decode a response of the comments API endpoint. The underlying reason was that the user violated Reddit's rate limits (which have been made more strict in July 2023), so the API returned an HTTP 429 ("Too many requests") response that Serde then unsurprisingly failed to parse as comment data.
Since dealing with rate limiting is a common issue in automated API clients, it would be nice if roux would provide better support here (both the user and roux-stream have no better way of handling this problem on their own, since roux does not expose any details about the process).
In particular, it would be great if roux
Checked for HTTP 429 responses and propagated them in a suitable form. Alternatively and probably even better, any HTTP error response should be propagated (e.g. via reqwest's Response.raise_for_status) instead of trying to parse it as JSON as usual.
Exposed the rate limiting information that the API provides via the X-Ratelimit-* HTTP headers (see the Reddit API rules). For example, the Subreddit methods could parse that information from the headers and store it in the Subreddit struct.
The text was updated successfully, but these errors were encountered:
In torfsen/roux-stream#12, a user's code crashed with hard-to-understand error messages that originated from Serde not being able to decode a response of the
comments
API endpoint. The underlying reason was that the user violated Reddit's rate limits (which have been made more strict in July 2023), so the API returned an HTTP 429 ("Too many requests") response that Serde then unsurprisingly failed to parse as comment data.Since dealing with rate limiting is a common issue in automated API clients, it would be nice if
roux
would provide better support here (both the user androux-stream
have no better way of handling this problem on their own, sinceroux
does not expose any details about the process).In particular, it would be great if
roux
Response.raise_for_status
) instead of trying to parse it as JSON as usual.X-Ratelimit-*
HTTP headers (see the Reddit API rules). For example, theSubreddit
methods could parse that information from the headers and store it in theSubreddit
struct.The text was updated successfully, but these errors were encountered: