Skip to content

Commit

Permalink
Add retry_after property to RateLimitException
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Dec 12, 2022
1 parent 6f68e9b commit 16dbc90
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 16dbc90

Please sign in to comment.