raise a RateLimitError when Twitter returns HTTP status 429
This commit is contained in:
parent
11279e2b4f
commit
e6e30baa43
1 changed files with 3 additions and 0 deletions
|
@ -76,6 +76,9 @@ template fetchImpl(result, additional_headers, fetchBody) {.dirty.} =
|
||||||
if resp.status == "401 Unauthorized" and result.len == 0:
|
if resp.status == "401 Unauthorized" and result.len == 0:
|
||||||
getContent()
|
getContent()
|
||||||
|
|
||||||
|
if resp.status == $Http429:
|
||||||
|
raise rateLimitError()
|
||||||
|
|
||||||
if resp.status == $Http503:
|
if resp.status == $Http503:
|
||||||
badClient = true
|
badClient = true
|
||||||
raise newException(InternalError, result)
|
raise newException(InternalError, result)
|
||||||
|
|
Loading…
Reference in a new issue