From 16dbc90e4adebeadae87cca889da59fb86554504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 12 Dec 2022 07:42:23 +0200 Subject: [PATCH] Add retry_after property to RateLimitException --- trakt/errors.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trakt/errors.py b/trakt/errors.py index e8a88371..06ce1769 100644 --- a/trakt/errors.py +++ b/trakt/errors.py @@ -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"""