Skip to content

Commit

Permalink
Ratelimit message fix on 429 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
xacadil authored Apr 4, 2024
1 parent dcfe262 commit 5a3a16d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tap_xero/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ def raise_for_error(resp):
if error_code == 429:
resp_headers = resp.headers
api_rate_limit_message = ERROR_CODE_EXCEPTION_MAPPING[429]["message"]
message = "HTTP-error-code: 429, Error: {}. Please retry after {} {}".format(api_rate_limit_message, resp_headers.get("Retry-After"),resp_headers.get("X-Rate-Limit-Problem"))
message = "HTTP-error-code: 429, Error: {}. Please retry after {} seconds. \nRemaining API calls for this day: {}".format(
api_rate_limit_message,
resp_headers.get("Retry-After"),
resp_headers.get("X-DayLimit-Remaining"),
)

#Raise XeroTooManyInMinuteError exception if minute limit is reached
if resp_headers.get("X-Rate-Limit-Problem") == 'minute':
Expand Down

0 comments on commit 5a3a16d

Please sign in to comment.