raise a RateLimitError when Twitter returns HTTP status 429

This commit is contained in:
PrivacyDev 2023-04-18 22:12:15 -04:00
parent 95893eedaa
commit 5828a6eccc

View file

@ -72,6 +72,9 @@ template fetchImpl(result, fetchBody) {.dirty.} =
if resp.status == "401 Unauthorized" and result.len == 0:
getContent()
if resp.status == $Http429:
raise rateLimitError()
if resp.status == $Http503:
badClient = true
raise newException(InternalError, result)