From 011ec41d0ce8a02689396f937b3e2738ca605120 Mon Sep 17 00:00:00 2001 From: Alexandros Milaios Date: Fri, 4 Oct 2024 09:29:22 +0300 Subject: [PATCH] fix: add logic to slow down api calls to avoid rate limiting (#208) --- .../connectors/source-recurly/setup.py | 2 +- .../source-recurly/source_recurly/streams.py | 27 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/airbyte-integrations/connectors/source-recurly/setup.py b/airbyte-integrations/connectors/source-recurly/setup.py index d866d9361d1b..6e652147b0e7 100644 --- a/airbyte-integrations/connectors/source-recurly/setup.py +++ b/airbyte-integrations/connectors/source-recurly/setup.py @@ -5,7 +5,7 @@ from setuptools import find_packages, setup -MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "recurly==4.10.0", "requests"] +MAIN_REQUIREMENTS = ["airbyte-cdk==0.67", "recurly==4.10.0", "requests"] TEST_REQUIREMENTS = [ "pytest~=6.1", diff --git a/airbyte-integrations/connectors/source-recurly/source_recurly/streams.py b/airbyte-integrations/connectors/source-recurly/source_recurly/streams.py index f7526476f4ae..63af3ee40dac 100644 --- a/airbyte-integrations/connectors/source-recurly/source_recurly/streams.py +++ b/airbyte-integrations/connectors/source-recurly/source_recurly/streams.py @@ -3,6 +3,7 @@ # import re +import time from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union from airbyte_cdk.models import SyncMode @@ -17,6 +18,7 @@ BEGIN_TIME_PARAM = "begin_time" END_TIME_PARAM = "end_time" +RATE_LIMIT_SLEEP_IN_SECS = 0.16 CAMEL_CASE_PATTERN = re.compile(r"(?