Skip to content

Commit 503e397

Browse files
authored
Source Marketo: update deprecated authenticator (#38631)
1 parent cb1438b commit 503e397

File tree

6 files changed

+142
-132
lines changed

6 files changed

+142
-132
lines changed

airbyte-integrations/connectors/source-marketo/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
connectorSubtype: api
1111
connectorType: source
1212
definitionId: 9e0556f4-69df-4522-a3fb-03264d36b348
13-
dockerImageTag: 1.4.0
13+
dockerImageTag: 1.4.1
1414
dockerRepository: airbyte/source-marketo
1515
documentationUrl: https://docs.airbyte.com/integrations/sources/marketo
1616
githubIssueLabel: source-marketo

airbyte-integrations/connectors/source-marketo/poetry.lock

+128-121
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

airbyte-integrations/connectors/source-marketo/pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "1.4.0"
6+
version = "1.4.1"
77
name = "source-marketo"
88
description = "Source implementation for Marketo."
99
authors = [ "Airbyte <[email protected]>",]
@@ -17,7 +17,7 @@ include = "source_marketo"
1717

1818
[tool.poetry.dependencies]
1919
python = "^3.9,<3.12"
20-
airbyte-cdk = "^0"
20+
airbyte-cdk = "0.90.0"
2121

2222
[tool.poetry.scripts]
2323
source-marketo = "source_marketo.run:run"

airbyte-integrations/connectors/source-marketo/source_marketo/source.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from airbyte_cdk.sources.streams import Stream
1818
from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy
1919
from airbyte_cdk.sources.streams.http import HttpStream
20-
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator
20+
from airbyte_cdk.sources.streams.http.requests_native_auth import Oauth2Authenticator
2121
from airbyte_cdk.utils import AirbyteTracedException
2222
from airbyte_protocol.models import FailureType
2323

@@ -450,8 +450,8 @@ def __init__(self, config):
450450
def get_refresh_request_params(self) -> Mapping[str, Any]:
451451
payload: MutableMapping[str, Any] = {
452452
"grant_type": "client_credentials",
453-
"client_id": self.client_id,
454-
"client_secret": self.client_secret,
453+
"client_id": self.get_client_id(),
454+
"client_secret": self.get_client_secret(),
455455
}
456456

457457
return payload
@@ -461,7 +461,7 @@ def refresh_access_token(self) -> Tuple[str, int]:
461461
Returns a tuple of (access_token, token_lifespan_in_seconds)
462462
"""
463463
try:
464-
response = requests.request(method="GET", url=self.token_refresh_endpoint, params=self.get_refresh_request_params())
464+
response = requests.request(method="GET", url=self.get_token_refresh_endpoint(), params=self.get_refresh_request_params())
465465
response.raise_for_status()
466466
response_json = response.json()
467467
return response_json["access_token"], response_json["expires_in"]

airbyte-integrations/connectors/source-marketo/unit_tests/test_source.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -304,19 +304,21 @@ def test_programs_normalize_datetime(config, requests_mock):
304304
def test_programs_next_page_token(config):
305305
page_size = 200
306306
records = [{"id": i} for i in range(page_size)]
307+
last_record = {"id": page_size - 1}
307308
mocked_response = MagicMock()
308309
mocked_response.json.return_value = {"result": records}
309310
stream = get_stream_by_name("programs", config)
310-
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, records) == page_size
311+
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, len(records), last_record) == page_size
311312

312313

313314
def test_segmentations_next_page_token(config):
314315
page_size = 200
315316
records = [{"id": i} for i in range(page_size)]
317+
last_record = {"id": page_size - 1}
316318
mocked_response = MagicMock()
317319
mocked_response.json.return_value = {"result": records}
318320
stream = get_stream_by_name("segmentations", config)
319-
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, records) == page_size
321+
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, len(records), last_record) == page_size
320322

321323

322324
today = pendulum.now()

docs/integrations/sources/marketo.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ If the 50,000 limit is too stringent, contact Marketo support for a quota increa
118118

119119
| Version | Date | Pull Request | Subject |
120120
| :------- | :--------- | :------------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
121+
| `1.4.1` | 2024-05-23 | [38631](https://github.com/airbytehq/airbyte/pull/38631) | Update deprecated authenticator package |
121122
| `1.4.0` | 2024-04-15 | [36854](https://github.com/airbytehq/airbyte/pull/36854) | Migrate to low-code |
122-
| 1.3.2 | 2024-04-19 | [36650](https://github.com/airbytehq/airbyte/pull/36650) | Updating to 0.80.0 CDK |
123-
| 1.3.1 | 2024-04-12 | [36650](https://github.com/airbytehq/airbyte/pull/36650) | schema descriptions |
123+
| `1.3.2` | 2024-04-19 | [36650](https://github.com/airbytehq/airbyte/pull/36650) | Updating to 0.80.0 CDK |
124+
| `1.3.1` | 2024-04-12 | [36650](https://github.com/airbytehq/airbyte/pull/36650) | schema descriptions |
124125
| `1.3.0` | 2024-03-19 | [36267](https://github.com/airbytehq/airbyte/pull/36267) | Pin airbyte-cdk version to `^0` |
125126
| `1.2.6` | 2024-02-09 | [35078](https://github.com/airbytehq/airbyte/pull/35078) | Manage dependencies with Poetry. |
126127
| `1.2.5` | 2024-01-15 | [34246](https://github.com/airbytehq/airbyte/pull/34246) | prepare for airbyte-lib |

0 commit comments

Comments
 (0)