Skip to content

Commit

Permalink
Source Marketo: update deprecated authenticator (#38631)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristoGrab authored May 23, 2024
1 parent cb1438b commit 503e397
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 9e0556f4-69df-4522-a3fb-03264d36b348
dockerImageTag: 1.4.0
dockerImageTag: 1.4.1
dockerRepository: airbyte/source-marketo
documentationUrl: https://docs.airbyte.com/integrations/sources/marketo
githubIssueLabel: source-marketo
Expand Down
249 changes: 128 additions & 121 deletions airbyte-integrations/connectors/source-marketo/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions airbyte-integrations/connectors/source-marketo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

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

[tool.poetry.dependencies]
python = "^3.9,<3.12"
airbyte-cdk = "^0"
airbyte-cdk = "0.90.0"

[tool.poetry.scripts]
source-marketo = "source_marketo.run:run"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import Oauth2Authenticator
from airbyte_cdk.utils import AirbyteTracedException
from airbyte_protocol.models import FailureType

Expand Down Expand Up @@ -450,8 +450,8 @@ def __init__(self, config):
def get_refresh_request_params(self) -> Mapping[str, Any]:
payload: MutableMapping[str, Any] = {
"grant_type": "client_credentials",
"client_id": self.client_id,
"client_secret": self.client_secret,
"client_id": self.get_client_id(),
"client_secret": self.get_client_secret(),
}

return payload
Expand All @@ -461,7 +461,7 @@ def refresh_access_token(self) -> Tuple[str, int]:
Returns a tuple of (access_token, token_lifespan_in_seconds)
"""
try:
response = requests.request(method="GET", url=self.token_refresh_endpoint, params=self.get_refresh_request_params())
response = requests.request(method="GET", url=self.get_token_refresh_endpoint(), params=self.get_refresh_request_params())
response.raise_for_status()
response_json = response.json()
return response_json["access_token"], response_json["expires_in"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,21 @@ def test_programs_normalize_datetime(config, requests_mock):
def test_programs_next_page_token(config):
page_size = 200
records = [{"id": i} for i in range(page_size)]
last_record = {"id": page_size - 1}
mocked_response = MagicMock()
mocked_response.json.return_value = {"result": records}
stream = get_stream_by_name("programs", config)
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, records) == page_size
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, len(records), last_record) == page_size


def test_segmentations_next_page_token(config):
page_size = 200
records = [{"id": i} for i in range(page_size)]
last_record = {"id": page_size - 1}
mocked_response = MagicMock()
mocked_response.json.return_value = {"result": records}
stream = get_stream_by_name("segmentations", config)
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, records) == page_size
assert stream.retriever.paginator.pagination_strategy.next_page_token(mocked_response, len(records), last_record) == page_size


today = pendulum.now()
Expand Down
5 changes: 3 additions & 2 deletions docs/integrations/sources/marketo.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ If the 50,000 limit is too stringent, contact Marketo support for a quota increa

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

0 comments on commit 503e397

Please sign in to comment.