Skip to content

Commit

Permalink
ref(source-amazon-seller-partner): add app_id to server configuration (
Browse files Browse the repository at this point in the history
…#53693)

Signed-off-by: Artem Inzhyyants <[email protected]>
  • Loading branch information
artem1205 authored Feb 17, 2025
1 parent d67a0fb commit 6ad9476
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 1,016 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ acceptance_tests:
spec:
tests:
- spec_path: "source_amazon_seller_partner/spec.json"
deployment_mode: "cloud"
- spec_path: "integration_tests/spec_oss.json"
connection:
tests:
- config_path: "secrets/config.json"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: e55879a8-0ef8-4557-abcf-ab34c53ec460
dockerImageTag: 4.5.1
dockerImageTag: 4.5.2
dockerRepository: airbyte/source-amazon-seller-partner
documentationUrl: https://docs.airbyte.com/integrations/sources/amazon-seller-partner
erdUrl: https://dbdocs.io/airbyteio/source-amazon-seller-partner?view=relationships
Expand Down
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 = "4.5.1"
version = "4.5.2"
name = "source-amazon-seller-partner"
description = "Source implementation for Amazon Seller Partner."
authors = ["Airbyte <[email protected]>"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
from source_amazon_seller_partner.utils import AmazonConfigException


# given the retention period: 730
DEFAULT_RETENTION_PERIOD_IN_DAYS = 730

from source_amazon_seller_partner.components.auth import AmazonSPOauthAuthenticator


class SourceAmazonSellerPartner(YamlDeclarativeSource):
def __init__(self, catalog: Optional[ConfiguredAirbyteCatalog], config: Optional[Mapping[str, Any]], state: TState, **kwargs):
super().__init__(catalog=catalog, config=config, state=state, **{"path_to_yaml": "manifest.yaml"})
Expand All @@ -29,41 +23,6 @@ def get_aws_config_settings(config: Mapping[str, Any]) -> Mapping[str, Any]:
endpoint, marketplace_id, _ = get_marketplaces(config.get("aws_environment"))[config.get("region")]
return {"endpoint": endpoint, "marketplace_id": marketplace_id}

@staticmethod
def _get_stream_kwargs(config: Mapping[str, Any]) -> Mapping[str, Any]:
endpoint, marketplace_id, _ = get_marketplaces(config.get("aws_environment"))[config.get("region")]
auth = AmazonSPOauthAuthenticator(
config=config,
parameters={},
token_refresh_endpoint="https://api.amazon.com/auth/o2/token",
client_id=config.get("lwa_app_id"),
client_secret=config.get("lwa_client_secret"),
refresh_token=config.get("refresh_token"),
host=endpoint.replace("https://", ""),
)

start_date = config.get("replication_start_date")
use_default_start_date = (
not start_date or (pendulum.now("utc") - pendulum.parse(start_date)).days > DEFAULT_RETENTION_PERIOD_IN_DAYS
)
if use_default_start_date:
start_date = pendulum.now("utc").subtract(days=DEFAULT_RETENTION_PERIOD_IN_DAYS).strftime("%Y-%m-%dT%H:%M:%SZ")

end_date = config.get("replication_end_date")
use_default_end_date = not end_date or end_date < start_date
if use_default_end_date:
end_date = None # None to sync all data

stream_kwargs = {
"url_base": endpoint,
"authenticator": auth,
"replication_start_date": start_date,
"marketplace_id": marketplace_id,
"period_in_days": config.get("period_in_days", 365),
"replication_end_date": end_date,
}
return stream_kwargs

def streams(self, config: Mapping[str, Any]) -> List[Stream]:
"""
:param config: A Mapping of the user input configuration as defined in the connector spec.
Expand Down
Loading

0 comments on commit 6ad9476

Please sign in to comment.