Skip to content

Commit 311641a

Browse files
authored
Merge branch 'main' into devin/1741122530-github-workflow-docker-build
2 parents 654bce2 + ab4a8ee commit 311641a

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# A new version of source-declarative-manifest is built for every new Airbyte CDK release, and their versions are kept in sync.
66
#
77

8-
FROM docker.io/airbyte/python-connector-base:3.0.0@sha256:1a0845ff2b30eafa793c6eee4e8f4283c2e52e1bbd44eed6cb9e9abd5d34d844
8+
FROM docker.io/airbyte/python-connector-base:4.0.0@sha256:d9894b6895923b379f3006fa251147806919c62b7d9021b5cd125bb67d7bbe22
99

1010
WORKDIR /airbyte/integration_code
1111

@@ -24,8 +24,8 @@ RUN pip install dist/*.whl
2424
RUN mkdir -p source_declarative_manifest \
2525
&& echo 'from source_declarative_manifest.run import run\n\nif __name__ == "__main__":\n run()' > main.py \
2626
&& touch source_declarative_manifest/__init__.py \
27-
&& cp /usr/local/lib/python3.10/site-packages/airbyte_cdk/cli/source_declarative_manifest/_run.py source_declarative_manifest/run.py \
28-
&& cp /usr/local/lib/python3.10/site-packages/airbyte_cdk/cli/source_declarative_manifest/spec.json source_declarative_manifest/
27+
&& cp /usr/local/lib/python3.11/site-packages/airbyte_cdk/cli/source_declarative_manifest/_run.py source_declarative_manifest/run.py \
28+
&& cp /usr/local/lib/python3.11/site-packages/airbyte_cdk/cli/source_declarative_manifest/spec.json source_declarative_manifest/
2929

3030
# Remove unnecessary build files
3131
RUN rm -rf dist/ pyproject.toml poetry.lock README.md

airbyte_cdk/sources/streams/http/error_handlers/default_error_mapping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
error_message="Invalid Protocol Schema: The endpoint that data is being requested from is using an invalid or insecure. Exception: requests.exceptions.InvalidSchema",
2020
),
2121
InvalidURL: ErrorResolution(
22-
response_action=ResponseAction.FAIL,
23-
failure_type=FailureType.config_error,
24-
error_message="Invalid URL specified: The endpoint that data is being requested from is not a valid URL. Exception: requests.exceptions.InvalidURL",
22+
response_action=ResponseAction.RETRY,
23+
failure_type=FailureType.transient_error,
24+
error_message="Invalid URL specified or DNS error occurred: The endpoint that data is being requested from is not a valid URL. Exception: requests.exceptions.InvalidURL",
2525
),
2626
RequestException: ErrorResolution(
2727
response_action=ResponseAction.RETRY,

unit_tests/sources/streams/http/test_http.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import pytest
1212
import requests
13+
from requests.exceptions import InvalidURL
1314

1415
from airbyte_cdk.models import AirbyteLogMessage, AirbyteMessage, Level, SyncMode, Type
1516
from airbyte_cdk.sources.streams import CheckpointMixin
@@ -20,7 +21,10 @@
2021
from airbyte_cdk.sources.streams.core import StreamData
2122
from airbyte_cdk.sources.streams.http import HttpStream, HttpSubStream
2223
from airbyte_cdk.sources.streams.http.error_handlers import ErrorHandler, HttpStatusErrorHandler
23-
from airbyte_cdk.sources.streams.http.error_handlers.response_models import ResponseAction
24+
from airbyte_cdk.sources.streams.http.error_handlers.response_models import (
25+
FailureType,
26+
ResponseAction,
27+
)
2428
from airbyte_cdk.sources.streams.http.exceptions import (
2529
DefaultBackoffException,
2630
RequestBodyException,
@@ -331,6 +335,20 @@ def test_raise_on_http_errors(mocker, error):
331335
assert send_mock.call_count == stream.max_retries + 1
332336

333337

338+
class StubHttpStreamWithErrorHandler(StubBasicReadHttpStream):
339+
def get_error_handler(self) -> Optional[ErrorHandler]:
340+
return HttpStatusErrorHandler(logging.getLogger())
341+
342+
343+
def test_dns_resolution_error_retry():
344+
"""Test that DNS resolution errors are retried"""
345+
stream = StubHttpStreamWithErrorHandler()
346+
error_handler = stream.get_error_handler()
347+
resolution = error_handler.interpret_response(InvalidURL())
348+
assert resolution.response_action == ResponseAction.RETRY
349+
assert resolution.failure_type == FailureType.transient_error
350+
351+
334352
class PostHttpStream(StubBasicReadHttpStream):
335353
http_method = "POST"
336354

0 commit comments

Comments
 (0)