raise a RateLimitError when Twitter returns HTTP status 429

This commit is contained in:
PrivacyDev 2023-04-18 22:12:15 -04:00
parent 11279e2b4f
commit e6e30baa43

View file

@ -76,6 +76,9 @@ template fetchImpl(result, additional_headers, 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)