-
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 FreshDesk: start using availability strategy
- Loading branch information
1 parent
f3c94fb
commit 0fec2ba
Showing
8 changed files
with
70 additions
and
69 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
airbyte-integrations/connectors/source-freshdesk/source_freshdesk/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,18 @@ | ||
import logging | ||
from typing import Dict, Optional | ||
|
||
import requests | ||
|
||
from airbyte_cdk.sources.streams.http.availability_strategy import HttpAvailabilityStrategy | ||
|
||
|
||
class FreshdeskAvailabilityStrategy(HttpAvailabilityStrategy): | ||
def reasons_for_unavailable_status_codes(self, stream, logger, source, error): | ||
unauthorized_error_message = f"The endpoint to access stream '{stream.name}' returned 401: Unauthorized. " | ||
unauthorized_error_message += "This is most likely due to wrong credentials. " | ||
unauthorized_error_message += self._visit_docs_message(logger, source) | ||
|
||
reasons: Dict[int, str] = super(FreshdeskAvailabilityStrategy, self).reasons_for_unavailable_status_codes(stream, logger, source, error) | ||
reasons[requests.codes.UNAUTHORIZED] = unauthorized_error_message | ||
|
||
return reasons |
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
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