From e5b909d83c2776f24e57a3bf2edcbd6307ce661b Mon Sep 17 00:00:00 2001 From: Remco Koopmans Date: Mon, 11 Mar 2024 08:32:38 +0100 Subject: [PATCH] Fix: X-RateLimit-Remaining may contain a comma (993, 999) --- fastly/api_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastly/api_client.py b/fastly/api_client.py index 7232d10..6134df7 100644 --- a/fastly/api_client.py +++ b/fastly/api_client.py @@ -242,7 +242,8 @@ def __call_api( return_data = None if method != "GET" and method != "HEAD": - self.rate_limit_remaining = int(response_data.getheader("Fastly-RateLimit-Remaining", default=DEFAULT_RATELIMIT)) + rate_limit = str(response_data.getheader("Fastly-RateLimit-Remaining", default=str(DEFAULT_RATELIMIT))) + self.rate_limit_remaining = int(rate_limit.split(',')[0]) self.rate_limit_reset = response_data.getheader("Fastly-RateLimit-Reset", default=0) if _return_http_data_only: