ingestr 0.14.3__py3-none-any.whl → 0.14.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ingestr might be problematic. Click here for more details.
- ingestr/src/buildinfo.py +1 -1
- ingestr/src/freshdesk/__init__.py +2 -0
- ingestr/src/freshdesk/freshdesk_client.py +15 -1
- ingestr/src/sources.py +8 -0
- {ingestr-0.14.3.dist-info → ingestr-0.14.4.dist-info}/METADATA +1 -1
- {ingestr-0.14.3.dist-info → ingestr-0.14.4.dist-info}/RECORD +9 -9
- {ingestr-0.14.3.dist-info → ingestr-0.14.4.dist-info}/WHEEL +0 -0
- {ingestr-0.14.3.dist-info → ingestr-0.14.4.dist-info}/entry_points.txt +0 -0
- {ingestr-0.14.3.dist-info → ingestr-0.14.4.dist-info}/licenses/LICENSE.md +0 -0
ingestr/src/buildinfo.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "v0.14.
|
|
1
|
+
version = "v0.14.4"
|
|
@@ -20,6 +20,7 @@ def freshdesk_source(
|
|
|
20
20
|
end_date: Optional[pendulum.DateTime] = None,
|
|
21
21
|
per_page: int = 100,
|
|
22
22
|
endpoints: Optional[List[str]] = None,
|
|
23
|
+
query: Optional[str] = None,
|
|
23
24
|
) -> Iterable[DltResource]:
|
|
24
25
|
"""
|
|
25
26
|
Retrieves data from specified Freshdesk API endpoints.
|
|
@@ -72,6 +73,7 @@ def freshdesk_source(
|
|
|
72
73
|
per_page=per_page,
|
|
73
74
|
start_date=start_date,
|
|
74
75
|
end_date=end_date,
|
|
76
|
+
query=query,
|
|
75
77
|
)
|
|
76
78
|
|
|
77
79
|
# Set default endpoints if not provided
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import time
|
|
5
|
-
from typing import Any, Dict, Iterable
|
|
5
|
+
from typing import Any, Dict, Iterable, Optional
|
|
6
6
|
|
|
7
7
|
import pendulum
|
|
8
8
|
from dlt.common.typing import TDataItem
|
|
@@ -70,6 +70,7 @@ class FreshdeskClient:
|
|
|
70
70
|
per_page: int,
|
|
71
71
|
start_date: pendulum.DateTime,
|
|
72
72
|
end_date: pendulum.DateTime,
|
|
73
|
+
query: Optional[str] = None,
|
|
73
74
|
) -> Iterable[TDataItem]:
|
|
74
75
|
"""
|
|
75
76
|
Fetches a paginated response from a specified endpoint.
|
|
@@ -79,6 +80,9 @@ class FreshdeskClient:
|
|
|
79
80
|
updated at the specified timestamp.
|
|
80
81
|
"""
|
|
81
82
|
page = 1
|
|
83
|
+
if query is not None:
|
|
84
|
+
query = query.replace('"', "").strip()
|
|
85
|
+
|
|
82
86
|
while True:
|
|
83
87
|
# Construct the URL for the specific endpoint
|
|
84
88
|
url = f"{self.base_url}/{endpoint}"
|
|
@@ -93,11 +97,21 @@ class FreshdeskClient:
|
|
|
93
97
|
|
|
94
98
|
params[param_key] = start_date.to_iso8601_string()
|
|
95
99
|
|
|
100
|
+
if query and endpoint == "tickets":
|
|
101
|
+
url = f"{self.base_url}/search/tickets"
|
|
102
|
+
params = {
|
|
103
|
+
"query": f'"{query}"',
|
|
104
|
+
"page": page,
|
|
105
|
+
}
|
|
106
|
+
|
|
96
107
|
# Handle requests with rate-limiting
|
|
97
108
|
# A maximum of 300 pages (30000 tickets) will be returned.
|
|
98
109
|
response = self._request_with_rate_limit(url, params=params)
|
|
99
110
|
data = response.json()
|
|
100
111
|
|
|
112
|
+
if query and endpoint == "tickets":
|
|
113
|
+
data = data["results"]
|
|
114
|
+
|
|
101
115
|
if not data:
|
|
102
116
|
break # Stop if no data or max page limit reached
|
|
103
117
|
|
ingestr/src/sources.py
CHANGED
|
@@ -2878,6 +2878,10 @@ class FreshdeskSource:
|
|
|
2878
2878
|
else:
|
|
2879
2879
|
end_date = None
|
|
2880
2880
|
|
|
2881
|
+
custom_query: Optional[str] = None
|
|
2882
|
+
if ":" in table:
|
|
2883
|
+
table, custom_query = table.split(":", 1)
|
|
2884
|
+
|
|
2881
2885
|
if table not in [
|
|
2882
2886
|
"agents",
|
|
2883
2887
|
"companies",
|
|
@@ -2888,6 +2892,9 @@ class FreshdeskSource:
|
|
|
2888
2892
|
]:
|
|
2889
2893
|
raise UnsupportedResourceError(table, "Freshdesk")
|
|
2890
2894
|
|
|
2895
|
+
if custom_query and table != "tickets":
|
|
2896
|
+
raise ValueError(f"Custom query is not supported for {table}")
|
|
2897
|
+
|
|
2891
2898
|
from ingestr.src.freshdesk import freshdesk_source
|
|
2892
2899
|
|
|
2893
2900
|
return freshdesk_source(
|
|
@@ -2895,6 +2902,7 @@ class FreshdeskSource:
|
|
|
2895
2902
|
domain=domain,
|
|
2896
2903
|
start_date=start_date,
|
|
2897
2904
|
end_date=end_date,
|
|
2905
|
+
query=custom_query,
|
|
2898
2906
|
).with_resources(table)
|
|
2899
2907
|
|
|
2900
2908
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ingestr
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.4
|
|
4
4
|
Summary: ingestr is a command-line application that ingests data from various sources and stores them in any database.
|
|
5
5
|
Project-URL: Homepage, https://github.com/bruin-data/ingestr
|
|
6
6
|
Project-URL: Issues, https://github.com/bruin-data/ingestr/issues
|
|
@@ -2,7 +2,7 @@ ingestr/conftest.py,sha256=OE2yxeTCosS9CUFVuqNypm-2ftYvVBeeq7egm3878cI,1981
|
|
|
2
2
|
ingestr/main.py,sha256=qo0g3wCFl8a_1jUwXagX8L1Q8PKKQlTF7md9pfnzW0Y,27155
|
|
3
3
|
ingestr/src/.gitignore,sha256=8cX1AZTSI0TcdZFGTmS_oyBjpfCzhOEt0DdAo2dFIY8,203
|
|
4
4
|
ingestr/src/blob.py,sha256=UUWMjHUuoR9xP1XZQ6UANQmnMVyDx3d0X4-2FQC271I,2138
|
|
5
|
-
ingestr/src/buildinfo.py,sha256=
|
|
5
|
+
ingestr/src/buildinfo.py,sha256=CMElSN6kWpX1OuAi0ov5fFYJdYbHWxQl5AOE3NOS_u4,20
|
|
6
6
|
ingestr/src/destinations.py,sha256=QtjE0AGs0WkPHaI2snWPHJ8HHi4lwXUBYLJPklz8Mvk,27772
|
|
7
7
|
ingestr/src/errors.py,sha256=Ufs4_DfE77_E3vnA1fOQdi6cmuLVNm7_SbFLkL1XPGk,686
|
|
8
8
|
ingestr/src/factory.py,sha256=7hOPrQSQowCvrVYBLTXE7BJl2pI7Eo5jdLkdpKSbkaw,7476
|
|
@@ -12,7 +12,7 @@ ingestr/src/loader.py,sha256=9NaWAyfkXdqAZSS-N72Iwo36Lbx4PyqIfaaH1dNdkFs,1712
|
|
|
12
12
|
ingestr/src/masking.py,sha256=VN0LdfvExhQ1bZMRylGtaBUIoH-vjuIUmRnYKwo3yiY,11358
|
|
13
13
|
ingestr/src/partition.py,sha256=BrIP6wFJvyR7Nus_3ElnfxknUXeCipK_E_bB8kZowfc,969
|
|
14
14
|
ingestr/src/resource.py,sha256=ZqmZxFQVGlF8rFPhBiUB08HES0yoTj8sZ--jKfaaVps,1164
|
|
15
|
-
ingestr/src/sources.py,sha256=
|
|
15
|
+
ingestr/src/sources.py,sha256=edVfJA4OpjNFMyn6oB2pifVHA1j-z7YYXTiLr_FQHzA,134324
|
|
16
16
|
ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
|
|
17
17
|
ingestr/src/time.py,sha256=H_Fk2J4ShXyUM-EMY7MqCLZQhlnZMZvO952bmZPc4yE,254
|
|
18
18
|
ingestr/src/version.py,sha256=J_2xgZ0mKlvuHcjdKCx2nlioneLH0I47JiU_Slr_Nwc,189
|
|
@@ -60,8 +60,8 @@ ingestr/src/fluxx/__init__.py,sha256=ILpfk-5U5NPqVTuMuEOfzmkbojttHDLBL-NYmItRlAM
|
|
|
60
60
|
ingestr/src/fluxx/helpers.py,sha256=zJmlQWwiv9snnLqTygiWVZy7-0rGi_K427hRUuZeHEM,6352
|
|
61
61
|
ingestr/src/frankfurter/__init__.py,sha256=gOdL8ZqgHHYZByjtfE3WX3BTRHdYqyn9FpQwzDHSAx0,5089
|
|
62
62
|
ingestr/src/frankfurter/helpers.py,sha256=SpRr992OcSf7IDI5y-ToUdO6m6sGpqFz59LTY0ojchI,1502
|
|
63
|
-
ingestr/src/freshdesk/__init__.py,sha256=
|
|
64
|
-
ingestr/src/freshdesk/freshdesk_client.py,sha256=
|
|
63
|
+
ingestr/src/freshdesk/__init__.py,sha256=OIP3GikA6BMh9sruU3jih-swdFNSposr48oQhy1WGNk,3145
|
|
64
|
+
ingestr/src/freshdesk/freshdesk_client.py,sha256=BzGCf_z9zUjqdSjU-0IzMt_C7uCIT9pU5qlcO9eu98Q,4829
|
|
65
65
|
ingestr/src/freshdesk/settings.py,sha256=0Wr_OMnUZcTlry7BmALssLxD2yh686JW4moLNv12Jnw,409
|
|
66
66
|
ingestr/src/fundraiseup/__init__.py,sha256=q3TQeP1HdbWNeXFMq-0-BdSo82Fq4Io1OEYOY1cAYcU,1743
|
|
67
67
|
ingestr/src/fundraiseup/client.py,sha256=klU57l8iJ5NAS1nTb_4UyVAerbPWpTa8PMHlpp9Riz0,2453
|
|
@@ -172,8 +172,8 @@ ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ
|
|
|
172
172
|
ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
|
|
173
173
|
ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
|
|
174
174
|
ingestr/tests/unit/test_smartsheets.py,sha256=zf3DXT29Y4TH2lNPBFphdjlaelUUyPJcsW2UO68RzDs,4862
|
|
175
|
-
ingestr-0.14.
|
|
176
|
-
ingestr-0.14.
|
|
177
|
-
ingestr-0.14.
|
|
178
|
-
ingestr-0.14.
|
|
179
|
-
ingestr-0.14.
|
|
175
|
+
ingestr-0.14.4.dist-info/METADATA,sha256=iktFVAzjjXbgReL__B3RnjolZsexAhwo-w3kEAseCFk,15265
|
|
176
|
+
ingestr-0.14.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
177
|
+
ingestr-0.14.4.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
|
|
178
|
+
ingestr-0.14.4.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
|
|
179
|
+
ingestr-0.14.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|