diff --git a/airbyte-cdk/python/airbyte_cdk/connector_builder/message_grouper.py b/airbyte-cdk/python/airbyte_cdk/connector_builder/message_grouper.py index bd7bc0bc59b0..6abde6724dd0 100644 --- a/airbyte-cdk/python/airbyte_cdk/connector_builder/message_grouper.py +++ b/airbyte-cdk/python/airbyte_cdk/connector_builder/message_grouper.py @@ -7,7 +7,6 @@ from copy import deepcopy from json import JSONDecodeError from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Union -from urllib.parse import parse_qs, urlparse from airbyte_cdk.connector_builder.models import ( AuxiliaryRequest, @@ -300,15 +299,12 @@ def _parse_json(log_message: AirbyteLogMessage) -> JsonType: @staticmethod def _create_request_from_log_message(json_http_message: Dict[str, Any]) -> HttpRequest: - url = urlparse(json_http_message.get("url", {}).get("full", "")) - full_path = f"{url.scheme}://{url.hostname}{url.path}" if url else "" + url = json_http_message.get("url", {}).get("full", "") request = json_http_message.get("http", {}).get("request", {}) - parameters = parse_qs(url.query) or None return HttpRequest( - url=full_path, + url=url, http_method=request.get("method", ""), headers=request.get("headers"), - parameters=parameters, body=request.get("body", {}).get("content", ""), ) diff --git a/airbyte-cdk/python/airbyte_cdk/connector_builder/models.py b/airbyte-cdk/python/airbyte_cdk/connector_builder/models.py index 06cbe215e447..8afab45cd6fd 100644 --- a/airbyte-cdk/python/airbyte_cdk/connector_builder/models.py +++ b/airbyte-cdk/python/airbyte_cdk/connector_builder/models.py @@ -16,7 +16,6 @@ class HttpResponse: @dataclass class HttpRequest: url: str - parameters: Optional[Dict[str, Any]] headers: Optional[Dict[str, Any]] http_method: str body: Optional[str] = None diff --git a/airbyte-cdk/python/unit_tests/connector_builder/test_message_grouper.py b/airbyte-cdk/python/unit_tests/connector_builder/test_message_grouper.py index f2602b960e73..cbbf84940207 100644 --- a/airbyte-cdk/python/unit_tests/connector_builder/test_message_grouper.py +++ b/airbyte-cdk/python/unit_tests/connector_builder/test_message_grouper.py @@ -106,8 +106,7 @@ def test_get_grouped_messages(mock_entrypoint_read: Mock) -> None: expected_pages = [ StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET", @@ -117,8 +116,7 @@ def test_get_grouped_messages(mock_entrypoint_read: Mock) -> None: ), StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET", @@ -166,8 +164,7 @@ def test_get_grouped_messages_with_logs(mock_entrypoint_read: Mock) -> None: expected_pages = [ StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET", @@ -177,8 +174,7 @@ def test_get_grouped_messages_with_logs(mock_entrypoint_read: Mock) -> None: ), StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET", @@ -351,8 +347,7 @@ def test_get_grouped_messages_no_records(mock_entrypoint_read: Mock) -> None: expected_pages = [ StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET", @@ -362,8 +357,7 @@ def test_get_grouped_messages_no_records(mock_entrypoint_read: Mock) -> None: ), StreamReadPages( request=HttpRequest( - url="https://demonslayers.com/api/v1/hashiras", - parameters={"era": ["taisho"]}, + url="https://demonslayers.com/api/v1/hashiras?era=taisho", headers={"Content-Type": "application/json"}, body='{"custom": "field"}', http_method="GET",