airbyte-source-iterable 1.0.0__tar.gz → 1.0.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 (30) hide show
  1. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/PKG-INFO +1 -1
  2. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/pyproject.toml +1 -1
  3. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/manifest.yaml +14 -1
  4. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/streams.py +24 -2
  5. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/.airbyte-pypi-readme.md +0 -0
  6. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/__init__.py +0 -0
  7. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/components.py +0 -0
  8. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/run.py +0 -0
  9. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/campaigns.json +0 -0
  10. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/campaigns_metrics.json +0 -0
  11. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/channels.json +0 -0
  12. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_bounce.json +0 -0
  13. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_click.json +0 -0
  14. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_complaint.json +0 -0
  15. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_open.json +0 -0
  16. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_send.json +0 -0
  17. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_send_skip.json +0 -0
  18. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_subscribe.json +0 -0
  19. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/email_unsubscribe.json +0 -0
  20. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/events.json +0 -0
  21. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/list_users.json +0 -0
  22. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/lists.json +0 -0
  23. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/message_types.json +0 -0
  24. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/metadata.json +0 -0
  25. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/templates.json +0 -0
  26. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/schemas/users.json +0 -0
  27. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/slice_generators.py +0 -0
  28. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/source.py +0 -0
  29. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.2}/source_iterable/spec.json +0 -0
  30. {airbyte_source_iterable-1.0.0 → airbyte_source_iterable-1.0.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: 1.0.0
3
+ Version: 1.0.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 = "1.0.0"
6
+ version = "1.0.2"
7
7
  name = "airbyte-source-iterable"
8
8
  description = "Source implementation for Iterable."
9
9
  authors = [ "Airbyte <contact@airbyte.io>",]
@@ -173,7 +173,20 @@ streams:
173
173
  retriever:
174
174
  type: SimpleRetriever
175
175
  paginator:
176
- type: NoPagination
176
+ type: DefaultPaginator
177
+ page_size_option:
178
+ type: RequestOption
179
+ field_name: pageSize
180
+ inject_into: request_parameter
181
+ page_token_option:
182
+ type: RequestOption
183
+ field_name: page
184
+ inject_into: request_parameter
185
+ pagination_strategy:
186
+ type: PageIncrement
187
+ page_size: 1000
188
+ start_from_page: 1
189
+ inject_on_first_request: true
177
190
  requester:
178
191
  path: campaigns
179
192
  type: HttpRequester
@@ -14,6 +14,7 @@ from pendulum.datetime import DateTime
14
14
  from requests import HTTPError
15
15
  from requests.exceptions import ChunkedEncodingError
16
16
 
17
+ from airbyte_cdk import AirbyteTracedException, FailureType
17
18
  from airbyte_cdk.models import SyncMode
18
19
  from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy
19
20
  from airbyte_cdk.sources.streams.core import CheckpointMixin, package_name_from_class
@@ -69,7 +70,7 @@ class IterableStream(HttpStream, ABC):
69
70
 
70
71
  def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
71
72
  """
72
- Iterable API does not support pagination
73
+ Most Iterable endpoints do not support pagination; streams that do override this.
73
74
  """
74
75
  return None
75
76
 
@@ -372,7 +373,11 @@ class IterableExportStreamAdjustableRange(IterableExportStream, ABC):
372
373
  self.logger.warn("ChunkedEncodingError occurred, decrease days range and try again")
373
374
  stream_slice = self._adjustable_generator.reduce_range()
374
375
  else:
375
- raise Exception(f"ChunkedEncodingError: Reached maximum number of retires: {self.CHUNKED_ENCODING_ERROR_RETRIES}")
376
+ raise AirbyteTracedException(
377
+ message="Iterable Export API response repeatedly closed for the selected event window.",
378
+ internal_message=f"ChunkedEncodingError: Reached maximum number of retries: {self.CHUNKED_ENCODING_ERROR_RETRIES}",
379
+ failure_type=FailureType.system_error,
380
+ )
376
381
 
377
382
 
378
383
  class IterableExportEventsStreamAdjustableRange(IterableExportStreamAdjustableRange, ABC):
@@ -383,10 +388,27 @@ class IterableExportEventsStreamAdjustableRange(IterableExportStreamAdjustableRa
383
388
 
384
389
  class Campaigns(IterableStream):
385
390
  data_field = "campaigns"
391
+ page_size = 1000
392
+
393
+ def __init__(self, authenticator, region: str = "US"):
394
+ self._page = 1
395
+ super().__init__(authenticator, region)
386
396
 
387
397
  def path(self, **kwargs) -> str:
388
398
  return "campaigns"
389
399
 
400
+ def request_params(self, stream_slice: Optional[Mapping[str, Any]] = None, **kwargs) -> MutableMapping[str, Any]:
401
+ next_page_token = kwargs.get("next_page_token")
402
+ page = next_page_token["page"] if next_page_token else 1
403
+ self._page = page
404
+ return {"page": page, "pageSize": self.page_size}
405
+
406
+ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
407
+ response_json = response.json() or {}
408
+ if len(response_json.get(self.data_field, [])) < self.page_size:
409
+ return None
410
+ return {"page": self._page + 1}
411
+
390
412
 
391
413
  class CampaignsMetrics(IterableStream):
392
414
  name = "campaigns_metrics"