airbyte-source-iterable 0.7.1__tar.gz → 0.7.2__tar.gz

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.
Files changed (31) hide show
  1. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/PKG-INFO +1 -1
  2. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/pyproject.toml +1 -1
  3. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/manifest.yaml +23 -13
  4. airbyte_source_iterable-0.7.2/source_iterable/source.py +117 -0
  5. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/spec.json +9 -1
  6. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/streams.py +9 -3
  7. airbyte_source_iterable-0.7.1/source_iterable/source.py +0 -116
  8. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/README.md +0 -0
  9. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/__init__.py +0 -0
  10. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/components.py +0 -0
  11. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/run.py +0 -0
  12. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/campaigns.json +0 -0
  13. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/campaigns_metrics.json +0 -0
  14. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/channels.json +0 -0
  15. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_bounce.json +0 -0
  16. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_click.json +0 -0
  17. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_complaint.json +0 -0
  18. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_open.json +0 -0
  19. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_send.json +0 -0
  20. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_send_skip.json +0 -0
  21. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_subscribe.json +0 -0
  22. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/email_unsubscribe.json +0 -0
  23. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/events.json +0 -0
  24. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/list_users.json +0 -0
  25. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/lists.json +0 -0
  26. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/message_types.json +0 -0
  27. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/metadata.json +0 -0
  28. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/templates.json +0 -0
  29. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/schemas/users.json +0 -0
  30. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/slice_generators.py +0 -0
  31. {airbyte_source_iterable-0.7.1 → airbyte_source_iterable-0.7.2}/source_iterable/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-source-iterable
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Source implementation for Iterable.
5
5
  Home-page: https://airbyte.com
6
6
  License: ELv2
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
3
3
  build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
- version = "0.7.1"
6
+ version = "0.7.2"
7
7
  name = "airbyte-source-iterable"
8
8
  description = "Source implementation for Iterable."
9
9
  authors = [ "Airbyte <contact@airbyte.io>",]
@@ -21,12 +21,22 @@ spec:
21
21
  type: "string"
22
22
  title: "Start Date"
23
23
  description: >-
24
- The date from which you'd like to replicate data for Iterable, in the format YYYY-MM-DDT00:00:00Z.
24
+ The date from which you'd like to replicate data for Iterable, in the format YYYY-MM-DDT00:00:00Z.
25
25
  All data generated after this date will be replicated.
26
26
  examples: ["2021-04-01T00:00:00Z"]
27
27
  pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$
28
28
  order: 1
29
29
  format: "date-time"
30
+ region:
31
+ type: "string"
32
+ title: "Region"
33
+ description: >-
34
+ The region where your Iterable account is hosted. Select 'EU' if your account is on the European data center.
35
+ enum:
36
+ - US
37
+ - EU
38
+ default: "US"
39
+ order: 2
30
40
  lookback_window:
31
41
  type: "integer"
32
42
  title: "Lookback Window (Minutes)"
@@ -38,7 +48,7 @@ spec:
38
48
  default: 5
39
49
  minimum: 0
40
50
  examples: [5, 10, 15]
41
- order: 2
51
+ order: 3
42
52
  type: DeclarativeSource
43
53
  check:
44
54
  type: CheckStream
@@ -54,7 +64,7 @@ streams:
54
64
  requester:
55
65
  path: lists
56
66
  type: HttpRequester
57
- url_base: https://api.iterable.com/api/
67
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
58
68
  http_method: GET
59
69
  authenticator:
60
70
  type: ApiKeyAuthenticator
@@ -86,7 +96,7 @@ streams:
86
96
  requester:
87
97
  path: lists/getUsers
88
98
  type: HttpRequester
89
- url_base: https://api.iterable.com/api/
99
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
90
100
  http_method: GET
91
101
  authenticator:
92
102
  type: ApiKeyAuthenticator
@@ -122,7 +132,7 @@ streams:
122
132
  type: SimpleRetriever
123
133
  requester:
124
134
  type: HttpRequester
125
- url_base: https://api.iterable.com/api/
135
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
126
136
  path: lists
127
137
  http_method: GET
128
138
  request_parameters: {}
@@ -167,7 +177,7 @@ streams:
167
177
  requester:
168
178
  path: campaigns
169
179
  type: HttpRequester
170
- url_base: https://api.iterable.com/api/
180
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
171
181
  http_method: GET
172
182
  authenticator:
173
183
  type: ApiKeyAuthenticator
@@ -197,7 +207,7 @@ streams:
197
207
  requester:
198
208
  path: channels
199
209
  type: HttpRequester
200
- url_base: https://api.iterable.com/api/
210
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
201
211
  http_method: GET
202
212
  authenticator:
203
213
  type: ApiKeyAuthenticator
@@ -227,7 +237,7 @@ streams:
227
237
  requester:
228
238
  path: messageTypes
229
239
  type: HttpRequester
230
- url_base: https://api.iterable.com/api/
240
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
231
241
  http_method: GET
232
242
  authenticator:
233
243
  type: ApiKeyAuthenticator
@@ -257,7 +267,7 @@ streams:
257
267
  requester:
258
268
  path: metadata
259
269
  type: HttpRequester
260
- url_base: https://api.iterable.com/api/
270
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
261
271
  http_method: GET
262
272
  authenticator:
263
273
  type: ApiKeyAuthenticator
@@ -288,7 +298,7 @@ streams:
288
298
  requester:
289
299
  path: export/data.json
290
300
  type: HttpRequester
291
- url_base: https://api.iterable.com/api/
301
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
292
302
  http_method: GET
293
303
  authenticator:
294
304
  type: ApiKeyAuthenticator
@@ -342,7 +352,7 @@ streams:
342
352
  type: JsonlDecoder
343
353
  requester:
344
354
  type: HttpRequester
345
- url_base: https://api.iterable.com/api/
355
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
346
356
  path: export/userEvents
347
357
  http_method: GET
348
358
  request_parameters:
@@ -385,7 +395,7 @@ streams:
385
395
  requester:
386
396
  path: lists/getUsers
387
397
  type: HttpRequester
388
- url_base: https://api.iterable.com/api/
398
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
389
399
  http_method: GET
390
400
  authenticator:
391
401
  type: ApiKeyAuthenticator
@@ -421,7 +431,7 @@ streams:
421
431
  type: SimpleRetriever
422
432
  requester:
423
433
  type: HttpRequester
424
- url_base: https://api.iterable.com/api/
434
+ url_base: "{{ 'https://api.eu.iterable.com/api/' if config.get('region', 'US') == 'EU' else 'https://api.iterable.com/api/' }}"
425
435
  path: lists
426
436
  http_method: GET
427
437
  request_parameters: {}
@@ -0,0 +1,117 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+ from typing import Any, List, Mapping
6
+
7
+ from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
8
+ from airbyte_cdk.sources.streams import Stream
9
+ from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
10
+
11
+ from .streams import (
12
+ CampaignsMetrics,
13
+ CustomEvent,
14
+ EmailBounce,
15
+ EmailClick,
16
+ EmailComplaint,
17
+ EmailOpen,
18
+ EmailSend,
19
+ EmailSendSkip,
20
+ EmailSubscribe,
21
+ EmailUnsubscribe,
22
+ HostedUnsubscribeClick,
23
+ InAppClick,
24
+ InAppClose,
25
+ InAppDelete,
26
+ InAppDelivery,
27
+ InAppOpen,
28
+ InAppSend,
29
+ InAppSendSkip,
30
+ InboxMessageImpression,
31
+ InboxSession,
32
+ Purchase,
33
+ PushBounce,
34
+ PushOpen,
35
+ PushSend,
36
+ PushSendSkip,
37
+ PushUninstall,
38
+ SmsBounce,
39
+ SmsClick,
40
+ SmsReceived,
41
+ SmsSend,
42
+ SmsSendSkip,
43
+ SmsUsageInfo,
44
+ Templates,
45
+ WebPushClick,
46
+ WebPushSend,
47
+ WebPushSendSkip,
48
+ )
49
+
50
+
51
+ """
52
+ This file provides the necessary constructs to interpret a provided declarative YAML configuration file into
53
+ source connector.
54
+
55
+ WARNING: Do not modify this file.
56
+ """
57
+
58
+
59
+ # Declarative Source
60
+ class SourceIterable(YamlDeclarativeSource):
61
+ def __init__(self):
62
+ super().__init__(**{"path_to_yaml": "manifest.yaml"})
63
+
64
+ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
65
+ streams = super().streams(config=config)
66
+
67
+ authenticator = TokenAuthenticator(token=config["api_key"], auth_header="Api-Key", auth_method="")
68
+ # end date is provided for integration tests only
69
+ start_date, end_date = config["start_date"], config.get("end_date")
70
+ lookback_window = config.get("lookback_window", 5)
71
+ date_range = {"start_date": start_date, "end_date": end_date, "lookback_window": lookback_window}
72
+ # CampaignsMetrics extends IterableStream (not IterableExportStream) and does not accept lookback_window
73
+ campaigns_date_range = {"start_date": start_date, "end_date": end_date}
74
+ region = config.get("region", "US")
75
+
76
+ # TODO: migrate streams below to low code as slicer logic will be migrated to generator based
77
+ streams.extend(
78
+ [
79
+ CampaignsMetrics(authenticator=authenticator, region=region, **campaigns_date_range),
80
+ Templates(authenticator=authenticator, region=region, **date_range),
81
+ EmailBounce(authenticator=authenticator, region=region, **date_range),
82
+ EmailClick(authenticator=authenticator, region=region, **date_range),
83
+ EmailComplaint(authenticator=authenticator, region=region, **date_range),
84
+ EmailOpen(authenticator=authenticator, region=region, **date_range),
85
+ EmailSend(authenticator=authenticator, region=region, **date_range),
86
+ EmailSendSkip(authenticator=authenticator, region=region, **date_range),
87
+ EmailSubscribe(authenticator=authenticator, region=region, **date_range),
88
+ EmailUnsubscribe(authenticator=authenticator, region=region, **date_range),
89
+ PushSend(authenticator=authenticator, region=region, **date_range),
90
+ PushSendSkip(authenticator=authenticator, region=region, **date_range),
91
+ PushOpen(authenticator=authenticator, region=region, **date_range),
92
+ PushUninstall(authenticator=authenticator, region=region, **date_range),
93
+ PushBounce(authenticator=authenticator, region=region, **date_range),
94
+ WebPushSend(authenticator=authenticator, region=region, **date_range),
95
+ WebPushClick(authenticator=authenticator, region=region, **date_range),
96
+ WebPushSendSkip(authenticator=authenticator, region=region, **date_range),
97
+ InAppSend(authenticator=authenticator, region=region, **date_range),
98
+ InAppOpen(authenticator=authenticator, region=region, **date_range),
99
+ InAppClick(authenticator=authenticator, region=region, **date_range),
100
+ InAppClose(authenticator=authenticator, region=region, **date_range),
101
+ InAppDelete(authenticator=authenticator, region=region, **date_range),
102
+ InAppDelivery(authenticator=authenticator, region=region, **date_range),
103
+ InAppSendSkip(authenticator=authenticator, region=region, **date_range),
104
+ InboxSession(authenticator=authenticator, region=region, **date_range),
105
+ InboxMessageImpression(authenticator=authenticator, region=region, **date_range),
106
+ SmsSend(authenticator=authenticator, region=region, **date_range),
107
+ SmsBounce(authenticator=authenticator, region=region, **date_range),
108
+ SmsClick(authenticator=authenticator, region=region, **date_range),
109
+ SmsReceived(authenticator=authenticator, region=region, **date_range),
110
+ SmsSendSkip(authenticator=authenticator, region=region, **date_range),
111
+ SmsUsageInfo(authenticator=authenticator, region=region, **date_range),
112
+ Purchase(authenticator=authenticator, region=region, **date_range),
113
+ CustomEvent(authenticator=authenticator, region=region, **date_range),
114
+ HostedUnsubscribeClick(authenticator=authenticator, region=region, **date_range),
115
+ ]
116
+ )
117
+ return streams
@@ -22,6 +22,14 @@
22
22
  "order": 1,
23
23
  "format": "date-time"
24
24
  },
25
+ "region": {
26
+ "type": "string",
27
+ "title": "Region",
28
+ "description": "The region where your Iterable account is hosted. Select 'EU' if your account is on the European data center.",
29
+ "enum": ["US", "EU"],
30
+ "default": "US",
31
+ "order": 2
32
+ },
25
33
  "lookback_window": {
26
34
  "type": "integer",
27
35
  "title": "Lookback Window (Minutes)",
@@ -29,7 +37,7 @@
29
37
  "default": 5,
30
38
  "minimum": 0,
31
39
  "examples": [5, 10, 15],
32
- "order": 2
40
+ "order": 3
33
41
  }
34
42
  }
35
43
  }
@@ -33,14 +33,20 @@ class IterableStream(HttpStream, ABC):
33
33
  # to prevent 429 error on other streams
34
34
  ignore_further_slices = False
35
35
 
36
- url_base = "https://api.iterable.com/api/"
37
36
  primary_key = "id"
38
37
 
39
- def __init__(self, authenticator):
38
+ def __init__(self, authenticator, region: str = "US"):
40
39
  self._cred = authenticator
41
40
  self._slice_retry = 0
41
+ self._region = region
42
42
  super().__init__(authenticator)
43
43
 
44
+ @property
45
+ def url_base(self) -> str:
46
+ if self._region == "EU":
47
+ return "https://api.eu.iterable.com/api/"
48
+ return "https://api.iterable.com/api/"
49
+
44
50
  @property
45
51
  def retry_factor(self) -> int:
46
52
  return 20
@@ -407,7 +413,7 @@ class CampaignsMetrics(IterableStream):
407
413
  return params
408
414
 
409
415
  def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, any]]]:
410
- lists = Campaigns(authenticator=self._cred)
416
+ lists = Campaigns(authenticator=self._cred, region=self._region)
411
417
  campaign_ids = []
412
418
  for list_record in lists.read_records(sync_mode=kwargs.get("sync_mode", SyncMode.full_refresh)):
413
419
  campaign_ids.append(list_record["id"])
@@ -1,116 +0,0 @@
1
- #
2
- # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
- #
4
-
5
- from typing import Any, List, Mapping
6
-
7
- from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
8
- from airbyte_cdk.sources.streams import Stream
9
- from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
10
-
11
- from .streams import (
12
- CampaignsMetrics,
13
- CustomEvent,
14
- EmailBounce,
15
- EmailClick,
16
- EmailComplaint,
17
- EmailOpen,
18
- EmailSend,
19
- EmailSendSkip,
20
- EmailSubscribe,
21
- EmailUnsubscribe,
22
- HostedUnsubscribeClick,
23
- InAppClick,
24
- InAppClose,
25
- InAppDelete,
26
- InAppDelivery,
27
- InAppOpen,
28
- InAppSend,
29
- InAppSendSkip,
30
- InboxMessageImpression,
31
- InboxSession,
32
- Purchase,
33
- PushBounce,
34
- PushOpen,
35
- PushSend,
36
- PushSendSkip,
37
- PushUninstall,
38
- SmsBounce,
39
- SmsClick,
40
- SmsReceived,
41
- SmsSend,
42
- SmsSendSkip,
43
- SmsUsageInfo,
44
- Templates,
45
- WebPushClick,
46
- WebPushSend,
47
- WebPushSendSkip,
48
- )
49
-
50
-
51
- """
52
- This file provides the necessary constructs to interpret a provided declarative YAML configuration file into
53
- source connector.
54
-
55
- WARNING: Do not modify this file.
56
- """
57
-
58
-
59
- # Declarative Source
60
- class SourceIterable(YamlDeclarativeSource):
61
- def __init__(self):
62
- super().__init__(**{"path_to_yaml": "manifest.yaml"})
63
-
64
- def streams(self, config: Mapping[str, Any]) -> List[Stream]:
65
- streams = super().streams(config=config)
66
-
67
- authenticator = TokenAuthenticator(token=config["api_key"], auth_header="Api-Key", auth_method="")
68
- # end date is provided for integration tests only
69
- start_date, end_date = config["start_date"], config.get("end_date")
70
- lookback_window = config.get("lookback_window", 5)
71
- date_range = {"start_date": start_date, "end_date": end_date, "lookback_window": lookback_window}
72
- # CampaignsMetrics extends IterableStream (not IterableExportStream) and does not accept lookback_window
73
- campaigns_date_range = {"start_date": start_date, "end_date": end_date}
74
-
75
- # TODO: migrate streams below to low code as slicer logic will be migrated to generator based
76
- streams.extend(
77
- [
78
- CampaignsMetrics(authenticator=authenticator, **campaigns_date_range),
79
- Templates(authenticator=authenticator, **date_range),
80
- EmailBounce(authenticator=authenticator, **date_range),
81
- EmailClick(authenticator=authenticator, **date_range),
82
- EmailComplaint(authenticator=authenticator, **date_range),
83
- EmailOpen(authenticator=authenticator, **date_range),
84
- EmailSend(authenticator=authenticator, **date_range),
85
- EmailSendSkip(authenticator=authenticator, **date_range),
86
- EmailSubscribe(authenticator=authenticator, **date_range),
87
- EmailUnsubscribe(authenticator=authenticator, **date_range),
88
- PushSend(authenticator=authenticator, **date_range),
89
- PushSendSkip(authenticator=authenticator, **date_range),
90
- PushOpen(authenticator=authenticator, **date_range),
91
- PushUninstall(authenticator=authenticator, **date_range),
92
- PushBounce(authenticator=authenticator, **date_range),
93
- WebPushSend(authenticator=authenticator, **date_range),
94
- WebPushClick(authenticator=authenticator, **date_range),
95
- WebPushSendSkip(authenticator=authenticator, **date_range),
96
- InAppSend(authenticator=authenticator, **date_range),
97
- InAppOpen(authenticator=authenticator, **date_range),
98
- InAppClick(authenticator=authenticator, **date_range),
99
- InAppClose(authenticator=authenticator, **date_range),
100
- InAppDelete(authenticator=authenticator, **date_range),
101
- InAppDelivery(authenticator=authenticator, **date_range),
102
- InAppSendSkip(authenticator=authenticator, **date_range),
103
- InboxSession(authenticator=authenticator, **date_range),
104
- InboxMessageImpression(authenticator=authenticator, **date_range),
105
- SmsSend(authenticator=authenticator, **date_range),
106
- SmsBounce(authenticator=authenticator, **date_range),
107
- SmsClick(authenticator=authenticator, **date_range),
108
- SmsReceived(authenticator=authenticator, **date_range),
109
- SmsSendSkip(authenticator=authenticator, **date_range),
110
- SmsUsageInfo(authenticator=authenticator, **date_range),
111
- Purchase(authenticator=authenticator, **date_range),
112
- CustomEvent(authenticator=authenticator, **date_range),
113
- HostedUnsubscribeClick(authenticator=authenticator, **date_range),
114
- ]
115
- )
116
- return streams