Skip to content

Commit

Permalink
Add retry_after property to RateLimitException (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Dec 12, 2022
2 parents 6f68e9b + 16dbc90 commit bbb1914
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions trakt/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class RateLimitException(TraktException):
http_code = 429
message = 'Rate Limit Exceeded'

@property
def retry_after(self):
return int(self.response.headers.get("Retry-After", 1))


class TraktInternalException(TraktException):
"""TraktException type to be raised when a 500 error is raised"""
Expand Down

0 comments on commit bbb1914

Please sign in to comment.