Skip to content

Commit f93fa72

Browse files
Source Zendesk Support: Handle 403 Error (#23035)
* Source Zendesk Support: Handle 403 Error * Source Zendesk Support: update docs * Source Zendesk Support: update allowed hosts * Source Zendesk Support: update expected records * Source Zendesk Support: update expected records * Source Zendesk Support: update expected records * Source Zendesk Support: update docs, bump version * auto-bump connector version --------- Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 0ee920e commit f93fa72

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,11 +2049,15 @@
20492049
- name: Zendesk Support
20502050
sourceDefinitionId: 79c1aa37-dae3-42ae-b333-d1c105477715
20512051
dockerRepository: airbyte/source-zendesk-support
2052-
dockerImageTag: 0.2.21
2052+
dockerImageTag: 0.2.23
20532053
documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-support
20542054
icon: zendesk-support.svg
20552055
sourceType: api
20562056
releaseStage: generally_available
2057+
allowedHosts:
2058+
hosts:
2059+
- "${subdomain}.zendesk.com"
2060+
- zendesk.com
20572061
- name: Zendesk Talk
20582062
sourceDefinitionId: c8630570-086d-4a40-99ae-ea5b18673071
20592063
dockerRepository: airbyte/source-zendesk-talk

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16468,7 +16468,7 @@
1646816468
path_in_connector_config:
1646916469
- "credentials"
1647016470
- "client_secret"
16471-
- dockerImage: "airbyte/source-zendesk-support:0.2.21"
16471+
- dockerImage: "airbyte/source-zendesk-support:0.2.23"
1647216472
spec:
1647316473
documentationUrl: "https://docs.airbyte.com/integrations/sources/zendesk-support"
1647416474
connectionSpecification:

airbyte-integrations/connectors/source-zendesk-support/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ COPY source_zendesk_support ./source_zendesk_support
2525
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
2626
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
2727

28-
LABEL io.airbyte.version=0.2.21
28+
LABEL io.airbyte.version=0.2.23
2929
LABEL io.airbyte.name=airbyte/source-zendesk-support

airbyte-integrations/connectors/source-zendesk-support/integration_tests/expected_records.jsonl

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def send_future(self, request: requests.PreparedRequest, **kwargs) -> Future:
110110

111111

112112
class BaseSourceZendeskSupportStream(HttpStream, ABC):
113+
raise_on_http_errors = True
114+
113115
def __init__(self, subdomain: str, start_date: str, ignore_pagination: bool = False, **kwargs):
114116
super().__init__(**kwargs)
115117

@@ -186,6 +188,13 @@ def parse_response(self, response: requests.Response, stream_state: Mapping[str,
186188
if not cursor_date or updated > cursor_date:
187189
yield record
188190

191+
def should_retry(self, response: requests.Response) -> bool:
192+
if response.status_code == 403:
193+
self.logger.error(f"Skipping stream {self.name}: Check permissions, error message: {response.json().get('error')}.")
194+
setattr(self, "raise_on_http_errors", False)
195+
return False
196+
return super().should_retry(response)
197+
189198

190199
class SourceZendeskSupportStream(BaseSourceZendeskSupportStream):
191200
"""Basic Zendesk class"""

airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_check(response, check_passed):
135135
[
136136
({"ticket_forms": [{"id": 1, "updated_at": "2021-07-08T00:05:45Z"}]}, 200, 18, []),
137137
({"error": "Not sufficient permissions"}, 403, 17, [
138-
"An exception occurred while trying to access TicketForms stream: 403 Client"
138+
"Skipping stream ticket_forms: Check permissions, error message: Not sufficient permissions."
139139
]),
140140
],
141141
ids=["forms_accessible", "forms_inaccessible"],
@@ -144,7 +144,7 @@ def test_full_access_streams(caplog, requests_mock, ticket_forms_response, statu
144144
requests_mock.get("/api/v2/ticket_forms", status_code=status_code, json=ticket_forms_response)
145145
result = SourceZendeskSupport().streams(config=TEST_CONFIG)
146146
assert len(result) == expected_n_streams
147-
logged_warnings = iter([record for record in caplog.records if record.levelname == "WARNING"])
147+
logged_warnings = iter([record for record in caplog.records if record.levelname == "ERROR"])
148148
for msg in expected_warnings:
149149
assert msg in next(logged_warnings).message
150150

docs/integrations/sources/zendesk-support.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ The Zendesk connector ideally should not run into Zendesk API limitations under
6060

6161
| Version | Date | Pull Request | Subject |
6262
|:---------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
63-
| `0.2.21` | 2023-01-27 | [22027](https://github.com/airbytehq/airbyte/pull/22027) | Set `AvailabilityStrategy` for streams explicitly to `None` |
63+
| `0.2.23` | 2023-02-15 | [23035](https://github.com/airbytehq/airbyte/pull/23035) | Handle 403 Error |
64+
| `0.2.22` | 2023-02-14 | [22483](https://github.com/airbytehq/airbyte/pull/22483) | Fix test; handle 400 error |
65+
| `0.2.21` | 2023-01-27 | [22027](https://github.com/airbytehq/airbyte/pull/22027) | Set `AvailabilityStrategy` for streams explicitly to `None` |
6466
| `0.2.20` | 2022-12-28 | [20900](https://github.com/airbytehq/airbyte/pull/20900) | Remove synchronous time.sleep, add logging, reduce backoff time |
6567
| `0.2.19` | 2022-12-09 | [19967](https://github.com/airbytehq/airbyte/pull/19967) | Fix reading response for more than 100k records |
6668
| `0.2.18` | 2022-11-29 | [19432](https://github.com/airbytehq/airbyte/pull/19432) | Revert changes from version 0.2.15, use a test read instead |

0 commit comments

Comments
 (0)