Skip to content

Commit 6664ebc

Browse files
committed
fix: extend ignored fields in response handling
1 parent b879e32 commit 6664ebc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

affinity_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def load_affinity_data() -> None:
1515
ListReference(247888, 1869904),
1616
ListReference(69224, 351112),
1717
ListReference(126638, 1133940),
18+
ListReference(126638, 1899475),
1819
ListReference(157541, 831583),
1920
],
2021
dev_mode=DEV_MODE,

dlt_source_affinity/rest_client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ def remove_unknown_fields(response: Response, *args: Any, **kwargs: Any) -> None
7575
We remove these fields to avoid errors when validating the data.
7676
TODO: remove this when the API is fixed. ASAP. And because this makes me really sad; again: ASAP.
7777
"""
78+
ignored_fields = [
79+
"connections",
80+
"note",
81+
"list-multi",
82+
"opportunity-multi",
83+
"reminder",
84+
]
7885
if "application/json" in response.headers.get("Content-Type", ""):
7986
data = response.json()
8087
if isinstance(data, dict) and "data" in data:
@@ -89,9 +96,9 @@ def remove_unknown_fields(response: Response, *args: Any, **kwargs: Any) -> None
8996
if isinstance(fields, list):
9097
to_remove = []
9198
for field in fields:
92-
if isinstance(field, dict) and (
93-
field["value"]["type"] == "connections"
94-
or field["value"]["type"] == "note"
99+
if (
100+
isinstance(field, dict)
101+
and field["value"]["type"] in ignored_fields
95102
):
96103
to_remove.append(field)
97104
changed = True

0 commit comments

Comments
 (0)