-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source Klaviyo: add availability strategy
- Loading branch information
Anton Karpets
committed
Oct 13, 2023
1 parent
e757fb8
commit d0e276a
Showing
4 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
airbyte-integrations/connectors/source-klaviyo/source_klaviyo/availability_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import logging | ||
from typing import Dict, Optional | ||
|
||
from airbyte_cdk.sources import Source | ||
from airbyte_cdk.sources.streams import Stream | ||
from airbyte_cdk.sources.streams.http.availability_strategy import HttpAvailabilityStrategy | ||
from requests import HTTPError, codes | ||
|
||
|
||
class KlaviyoAvailabilityStrategyLatest(HttpAvailabilityStrategy): | ||
def reasons_for_unavailable_status_codes( | ||
self, stream: Stream, logger: logging.Logger, source: Optional[Source], error: HTTPError | ||
) -> Dict[int, str]: | ||
reasons_for_codes: Dict[int, str] = super().reasons_for_unavailable_status_codes(stream, logger, source, error) | ||
reasons_for_codes[codes.UNAUTHORIZED] = ( | ||
"This is most likely due to insufficient permissions on the credentials in use. " | ||
"Try to grant required permissions/scopes or re-authenticate" | ||
) | ||
|
||
return reasons_for_codes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters