From a6990bc1958c28fcc4718676f8fc5f9710cdb108 Mon Sep 17 00:00:00 2001 From: Arsen Losenko <20901439+arsenlosenko@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:35:21 +0200 Subject: [PATCH] Source Recharge: use default availability strategy (#22473) * Source Recharge: use default availability strategy * Remove invalid_config from full_refresh tests * Update changelog * Remove error handling that is covered by HttpAvailabilityStrategy * Keep should_retry, change error handling --------- Co-authored-by: Serhii Lazebnyi <53845333+lazebnyi@users.noreply.github.com> --- .../init/src/main/resources/seed/source_definitions.yaml | 3 +++ .../connectors/source-recharge/Dockerfile | 2 +- .../connectors/source-recharge/source_recharge/api.py | 9 --------- docs/integrations/sources/recharge.md | 1 + 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index b1a60a7a5880..42d71e5909a1 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -1465,6 +1465,9 @@ icon: recharge.svg sourceType: api releaseStage: generally_available + allowedHosts: + hosts: + - api.rechargeapps.com - name: Recreation sourceDefinitionId: 25d7535d-91e0-466a-aa7f-af81578be277 dockerRepository: airbyte/source-recreation diff --git a/airbyte-integrations/connectors/source-recharge/Dockerfile b/airbyte-integrations/connectors/source-recharge/Dockerfile index bc55a801d19b..993c861ab5de 100644 --- a/airbyte-integrations/connectors/source-recharge/Dockerfile +++ b/airbyte-integrations/connectors/source-recharge/Dockerfile @@ -12,5 +12,5 @@ RUN pip install . ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.2.5 +LABEL io.airbyte.version=0.2.6 LABEL io.airbyte.name=airbyte/source-recharge diff --git a/airbyte-integrations/connectors/source-recharge/source_recharge/api.py b/airbyte-integrations/connectors/source-recharge/source_recharge/api.py index bff8cf65247f..b919215f6c57 100644 --- a/airbyte-integrations/connectors/source-recharge/source_recharge/api.py +++ b/airbyte-integrations/connectors/source-recharge/source_recharge/api.py @@ -8,7 +8,6 @@ import pendulum import requests -from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy from airbyte_cdk.sources.streams.http import HttpStream from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer @@ -29,10 +28,6 @@ class RechargeStream(HttpStream, ABC): def data_path(self): return self.name - @property - def availability_strategy(self) -> Optional["AvailabilityStrategy"]: - return None - def path( self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> str: @@ -72,10 +67,6 @@ def should_retry(self, response: requests.Response) -> bool: if incomplete_data_response: return True - elif response.status_code == requests.codes.FORBIDDEN: - setattr(self, "raise_on_http_errors", False) - self.logger.error(f"Skiping stream {self.name} because of a 403 error.") - return False return super().should_retry(response) diff --git a/docs/integrations/sources/recharge.md b/docs/integrations/sources/recharge.md index 20ca424b13d1..79e67b60f9a6 100644 --- a/docs/integrations/sources/recharge.md +++ b/docs/integrations/sources/recharge.md @@ -76,6 +76,7 @@ The Recharge connector should gracefully handle Recharge API limitations under n | Version | Date | Pull Request | Subject | |:--------| :--------- | :------------------------------------------------------- | :---------------------------------------------------------------------------------------- | +| 0.2.6 | 2023-02-07 | [22473](https://github.com/airbytehq/airbyte/pull/22473) | Use default availability strategy | 0.2.5 | 2023-01-27 | [22021](https://github.com/airbytehq/airbyte/pull/22021) | Set `AvailabilityStrategy` for streams explicitly to `None` | | 0.2.4 | 2022-10-11 | [17822](https://github.com/airbytehq/airbyte/pull/17822) | Do not parse JSON in `should_retry` | | 0.2.3 | 2022-10-11 | [17822](https://github.com/airbytehq/airbyte/pull/17822) | Do not parse JSON in `should_retry` |