Skip to content

Commit 5846c65

Browse files
ireyna-modoVincent Kocvincentkococtavia-squidington-iii
authored
šŸ› Source Freshdesk: Add mising / that's causing issues when building URL (#18397)
* Add mising / that's causing issues when building URL * attempt to align changes with tests * Update test_300_page.py * Update Dockerfile * Update freshdesk.md * auto-bump connector version Co-authored-by: Vincent Koc <koconder@users.noreply.github.com> Co-authored-by: Vincent Koc <koconder@gmail.com> Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
1 parent 91bb1bf commit 5846c65

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401
- name: Freshdesk
402402
sourceDefinitionId: ec4b9503-13cb-48ab-a4ab-6ade4be46567
403403
dockerRepository: airbyte/source-freshdesk
404-
dockerImageTag: 0.3.6
404+
dockerImageTag: 0.3.7
405405
documentationUrl: https://docs.airbyte.com/integrations/sources/freshdesk
406406
icon: freshdesk.svg
407407
sourceType: api

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3831,7 +3831,7 @@
38313831
supportsNormalization: false
38323832
supportsDBT: false
38333833
supported_destination_sync_modes: []
3834-
- dockerImage: "airbyte/source-freshdesk:0.3.6"
3834+
- dockerImage: "airbyte/source-freshdesk:0.3.7"
38353835
spec:
38363836
documentationUrl: "https://docs.airbyte.com/integrations/sources/freshdesk"
38373837
connectionSpecification:

ā€Žairbyte-integrations/connectors/source-freshdesk/Dockerfileā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ COPY source_freshdesk ./source_freshdesk
3434
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3535
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3636

37-
LABEL io.airbyte.version=0.3.6
37+
LABEL io.airbyte.version=0.3.7
3838
LABEL io.airbyte.name=airbyte/source-freshdesk

ā€Žairbyte-integrations/connectors/source-freshdesk/source_freshdesk/streams.pyā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, authenticator: AuthBase, config: Mapping[str, Any], *args, **
4444

4545
@property
4646
def url_base(self) -> str:
47-
return parse.urljoin(f"https://{self.domain.rstrip('/')}", "/api/v2")
47+
return parse.urljoin(f"https://{self.domain.rstrip('/')}", "/api/v2/")
4848

4949
def backoff_time(self, response: requests.Response) -> Optional[float]:
5050
if response.status_code == requests.codes.too_many_requests:

ā€Žairbyte-integrations/connectors/source-freshdesk/unit_tests/test_300_page.pyā€Ž

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,70 @@
1111
def responses_fixtures():
1212
return [
1313
{
14-
"url": "/api/tickets?per_page=1&updated_since=2002-02-10T22%3A21%3A44Z",
14+
"url": "/api/v2/tickets?per_page=1&updated_since=2002-02-10T22%3A21%3A44Z",
1515
"json": [{"id": 1, "updated_at": "2018-01-02T00:00:00Z"}],
1616
"headers": {
17-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=2&updated_since=2002-02-10T22%3A21%3A44Z>; rel="next"'
17+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=2&updated_since=2002-02-10T22%3A21%3A44Z>; rel="next"'
1818
},
1919
},
2020
{
21-
"url": "/api/tickets?per_page=1&page=2&updated_since=2002-02-10T22%3A21%3A44Z",
21+
"url": "/api/v2/tickets?per_page=1&page=2&updated_since=2002-02-10T22%3A21%3A44Z",
2222
"json": [{"id": 2, "updated_at": "2018-02-02T00:00:00Z"}],
2323
"headers": {
24-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=3&updated_since=2002-02-10T22%3A21%3A44Z>; rel="next"'
24+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=3&updated_since=2002-02-10T22%3A21%3A44Z>; rel="next"'
2525
},
2626
},
2727
{
28-
"url": "/api/tickets?per_page=1&updated_since=2018-02-02T00%3A00%3A00Z",
28+
"url": "/api/v2/tickets?per_page=1&updated_since=2018-02-02T00%3A00%3A00Z",
2929
"json": [{"id": 2, "updated_at": "2018-02-02T00:00:00Z"}],
3030
"headers": {
31-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=2&updated_since=2018-02-02T00%3A00%3A00Z>; rel="next"'
31+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=2&updated_since=2018-02-02T00%3A00%3A00Z>; rel="next"'
3232
},
3333
},
3434
{
35-
"url": "/api/tickets?per_page=1&page=2&updated_since=2018-02-02T00%3A00%3A00Z",
35+
"url": "/api/v2/tickets?per_page=1&page=2&updated_since=2018-02-02T00%3A00%3A00Z",
3636
"json": [{"id": 3, "updated_at": "2018-03-02T00:00:00Z"}],
3737
"headers": {
38-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=3&updated_since=2018-02-02T00%3A00%3A00Z>; rel="next"'
38+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=3&updated_since=2018-02-02T00%3A00%3A00Z>; rel="next"'
3939
},
4040
},
4141
{
42-
"url": "/api/tickets?per_page=1&updated_since=2018-03-02T00%3A00%3A00Z",
42+
"url": "/api/v2/tickets?per_page=1&updated_since=2018-03-02T00%3A00%3A00Z",
4343
"json": [{"id": 3, "updated_at": "2018-03-02T00:00:00Z"}],
4444
"headers": {
45-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=2&updated_since=2018-03-02T00%3A00%3A00Z>; rel="next"'
45+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=2&updated_since=2018-03-02T00%3A00%3A00Z>; rel="next"'
4646
},
4747
},
4848
{
49-
"url": "/api/tickets?per_page=1&page=2&updated_since=2018-03-02T00%3A00%3A00Z",
49+
"url": "/api/v2/tickets?per_page=1&page=2&updated_since=2018-03-02T00%3A00%3A00Z",
5050
"json": [{"id": 4, "updated_at": "2019-01-03T00:00:00Z"}],
5151
"headers": {
52-
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=3&updated_since=2018-03-02T00%3A00%3A00Z>; rel="next"'
52+
"Link": '<https://test.freshdesk.com/api/v2/tickets?per_page=1&page=3&updated_since=2018-03-02T00%3A00%3A00Z>; rel="next"'
5353
},
5454
},
5555
{
56-
"url": "/api/tickets?per_page=1&updated_since=2019-01-03T00%3A00%3A00Z",
56+
"url": "/api/v2/tickets?per_page=1&updated_since=2019-01-03T00%3A00%3A00Z",
5757
"json": [{"id": 4, "updated_at": "2019-01-03T00:00:00Z"}],
5858
"headers": {
5959
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=2&updated_since=2019-01-03T00%3A00%3A00Z>; rel="next"'
6060
},
6161
},
6262
{
63-
"url": "/api/tickets?per_page=1&page=2&updated_since=2019-01-03T00%3A00%3A00Z",
63+
"url": "/api/v2/tickets?per_page=1&page=2&updated_since=2019-01-03T00%3A00%3A00Z",
6464
"json": [{"id": 5, "updated_at": "2019-02-03T00:00:00Z"}],
6565
"headers": {
6666
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=3&updated_since=2019-01-03T00%3A00%3A00Z>; rel="next"'
6767
},
6868
},
6969
{
70-
"url": "/api/tickets?per_page=1&updated_since=2019-02-03T00%3A00%3A00Z",
70+
"url": "/api/v2/tickets?per_page=1&updated_since=2019-02-03T00%3A00%3A00Z",
7171
"json": [{"id": 5, "updated_at": "2019-02-03T00:00:00Z"}],
7272
"headers": {
7373
"Link": '<https://test.freshdesk.com/api/tickets?per_page=1&page=2&updated_since=2019-02-03T00%3A00%3A00Z>; rel="next"'
7474
},
7575
},
7676
{
77-
"url": "/api/tickets?per_page=1&page=2&updated_since=2019-02-03T00%3A00%3A00Z",
77+
"url": "/api/v2/tickets?per_page=1&page=2&updated_since=2019-02-03T00%3A00%3A00Z",
7878
"json": [{"id": 6, "updated_at": "2019-03-03T00:00:00Z"}],
7979
},
8080
]

ā€Žairbyte-integrations/connectors/source-freshdesk/unit_tests/test_streams.pyā€Ž

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _read_incremental(stream_instance: Stream, stream_state: MutableMapping[str,
8484
],
8585
)
8686
def test_full_refresh(stream, resource, authenticator, config, requests_mock):
87-
requests_mock.register_uri("GET", f"/api/{resource}", json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(25)])
87+
requests_mock.register_uri("GET", f"/api/v2/{resource}", json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(25)])
8888

8989
stream = stream(authenticator=authenticator, config=config)
9090
records = _read_full_refresh(stream)
@@ -93,9 +93,9 @@ def test_full_refresh(stream, resource, authenticator, config, requests_mock):
9393

9494

9595
def test_full_refresh_conversations(authenticator, config, requests_mock):
96-
requests_mock.register_uri("GET", "/api/tickets", json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(5)])
96+
requests_mock.register_uri("GET", "/api/v2/tickets", json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(5)])
9797
for i in range(5):
98-
requests_mock.register_uri("GET", f"/api/tickets/{i}/conversations", json=[{"id": x} for x in range(10)])
98+
requests_mock.register_uri("GET", f"/api/v2/tickets/{i}/conversations", json=[{"id": x} for x in range(10)])
9999

100100
stream = Conversations(authenticator=authenticator, config=config)
101101
records = _read_full_refresh(stream)
@@ -105,7 +105,7 @@ def test_full_refresh_conversations(authenticator, config, requests_mock):
105105

106106
def test_full_refresh_settings(authenticator, config, requests_mock):
107107
json_resp = {"primary_language": "en", "supported_languages": [], "portal_languages": []}
108-
requests_mock.register_uri("GET", "/api/settings/helpdesk", json=json_resp)
108+
requests_mock.register_uri("GET", "/api/v2/settings/helpdesk", json=json_resp)
109109

110110
stream = Settings(authenticator=authenticator, config=config)
111111
records = _read_full_refresh(stream)
@@ -129,7 +129,7 @@ def test_incremental(stream, resource, authenticator, config, requests_mock):
129129
with patch(f"source_freshdesk.streams.{stream.__name__}.use_cache", new_callable=PropertyMock, return_value=False):
130130
requests_mock.register_uri(
131131
"GET",
132-
f"/api/{resource}",
132+
f"/api/v2/{resource}",
133133
json=[{"id": x, "updated_at": highest_updated_at if x == highest_index else other_updated_at} for x in range(25)],
134134
)
135135

@@ -151,9 +151,9 @@ def test_incremental(stream, resource, authenticator, config, requests_mock):
151151
],
152152
)
153153
def test_substream_full_refresh(requests_mock, stream_class, parent_path, sub_paths, authenticator, config):
154-
requests_mock.register_uri("GET", "/api/" + parent_path, json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(5)])
154+
requests_mock.register_uri("GET", "/api/v2/" + parent_path, json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(5)])
155155
for sub_path in sub_paths:
156-
requests_mock.register_uri("GET", "/api/" + sub_path, json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(10)])
156+
requests_mock.register_uri("GET", "/api/v2/" + sub_path, json=[{"id": x, "updated_at": "2022-05-05T00:00:00Z"} for x in range(10)])
157157

158158
stream = stream_class(authenticator=authenticator, config=config)
159159
records = _read_full_refresh(stream)
@@ -179,11 +179,11 @@ def test_substream_full_refresh(requests_mock, stream_class, parent_path, sub_pa
179179
],
180180
)
181181
def test_full_refresh_with_two_sub_levels(requests_mock, stream_class, parent_path, sub_paths, sub_sub_paths, authenticator, config):
182-
requests_mock.register_uri("GET", f"/api/{parent_path}", json=[{"id": x} for x in range(5)])
182+
requests_mock.register_uri("GET", f"/api/v2/{parent_path}", json=[{"id": x} for x in range(5)])
183183
for sub_path in sub_paths:
184-
requests_mock.register_uri("GET", f"/api/{sub_path}", json=[{"id": x} for x in range(5)])
184+
requests_mock.register_uri("GET", f"/api/v2/{sub_path}", json=[{"id": x} for x in range(5)])
185185
for sub_sub_path in sub_sub_paths:
186-
requests_mock.register_uri("GET", f"/api/{sub_sub_path}", json=[{"id": x} for x in range(10)])
186+
requests_mock.register_uri("GET", f"/api/v2/{sub_sub_path}", json=[{"id": x} for x in range(10)])
187187

188188
stream = stream_class(authenticator=authenticator, config=config)
189189
records = _read_full_refresh(stream)
@@ -192,13 +192,13 @@ def test_full_refresh_with_two_sub_levels(requests_mock, stream_class, parent_pa
192192

193193

194194
def test_full_refresh_discussion_comments(requests_mock, authenticator, config):
195-
requests_mock.register_uri("GET", "/api/discussions/categories", json=[{"id": x} for x in range(2)])
195+
requests_mock.register_uri("GET", "/api/v2/discussions/categories", json=[{"id": x} for x in range(2)])
196196
for i in range(2):
197-
requests_mock.register_uri("GET", f"/api/discussions/categories/{i}/forums", json=[{"id": x} for x in range(3)])
197+
requests_mock.register_uri("GET", f"/api/v2/discussions/categories/{i}/forums", json=[{"id": x} for x in range(3)])
198198
for j in range(3):
199-
requests_mock.register_uri("GET", f"/api/discussions/forums/{j}/topics", json=[{"id": x} for x in range(4)])
199+
requests_mock.register_uri("GET", f"/api/v2/discussions/forums/{j}/topics", json=[{"id": x} for x in range(4)])
200200
for k in range(4):
201-
requests_mock.register_uri("GET", f"/api/discussions/topics/{k}/comments", json=[{"id": x} for x in range(5)])
201+
requests_mock.register_uri("GET", f"/api/v2/discussions/topics/{k}/comments", json=[{"id": x} for x in range(5)])
202202

203203
stream = DiscussionComments(authenticator=authenticator, config=config)
204204
records = _read_full_refresh(stream)

ā€Ždocs/integrations/sources/freshdesk.mdā€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The Freshdesk connector should not run into Freshdesk API limitations under norm
5050

5151
| Version | Date | Pull Request | Subject |
5252
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------ |
53+
| 0.3.7 | 2022-11-03 | [18397](https://github.com/airbytehq/airbyte/pull/18397) | Fix base url for v2 API. |
5354
| 0.3.6 | 2022-09-29 | [17410](https://github.com/airbytehq/airbyte/pull/17410) | Migrate to per-stream states. |
5455
| 0.3.5 | 2022-09-27 | [17249](https://github.com/airbytehq/airbyte/pull/17249) | Added nullable to all stream schemas, added transformation into declared schema types |
5556
| 0.3.4 | 2022-09-27 | [17243](https://github.com/airbytehq/airbyte/pull/17243) | Fixed the issue, when selected stream is not available due to Subscription Plan |

0 commit comments

Comments
Ā (0)