From 7919c6df69ecd2592659ee7fcb7a0b6b6b5ace86 Mon Sep 17 00:00:00 2001 From: jlloyd-widen <82222659+jlloyd-widen@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:26:24 -0600 Subject: [PATCH] fixed get_wait_time_based_on_response (#3) --- pyproject.toml | 2 +- tap_salesforce_connect/client.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 60d0a48..c2c738d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tap-salesforce-connect" -version = "0.1.2" +version = "0.1.3" description = "`tap-salesforce-connect` is a Singer tap for SalesforceConnect, built with the Meltano Singer SDK." readme = "README.md" authors = ["Josh Lloyd"] diff --git a/tap_salesforce_connect/client.py b/tap_salesforce_connect/client.py index 25dd130..346f3eb 100644 --- a/tap_salesforce_connect/client.py +++ b/tap_salesforce_connect/client.py @@ -114,9 +114,13 @@ def get_wait_time_based_on_response(self, exception): Salesforce Connect API has a rate limit scoped to an hour """ - if exception.response.status_code == 503: - return 60 * 60 - return exception.response.headers.get("Retry-After", 0) + if exception.response: + if exception.response.status_code == 503: + return 60 * 60 + else: + return exception.response.headers.get("Retry-After", 0) + else: + return 0 def backoff_wait_generator(self) -> Generator[float, None, None]: """Return a generator of wait times between retries."""