Aazam Thakur
06/15/2023, 10:21 PMListMembers which gets the list_id from the Lists class to use it in the url lists/{list_id}/members
class Lists(IncrementalMailChimpStream):
cursor_field = "date_created"
data_field = "lists"
def path(self, **kwargs) -> str:
return "lists"kapa.ai
06/15/2023, 10:21 PMkapa.ai
06/15/2023, 10:21 PMListMembers that gets the list_id from the Lists class, you can follow a similar approach as shown in the [previous support conversation](https://airbytehq.slack.com/archives/C021JANJ6TY/p1657131854374819) from the Slack extracts. Here's how you can do it: 1. Create a new class ListMembers that inherits from IncrementalMailChimpStream or any other appropriate base class. 2. Override the read_records method in the ListMembers class to iterate through the records from the Lists class and get the list_id. 3. Use the list_id in the path method to construct the URL for the ListMembers API endpoint. Here's an example based on the information from the extracts: python class ListMembers(IncrementalMailChimpStream): # Add any necessary fields and methods for the ListMembers class def read_records(self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_slice: Mapping[str, Any] = None, stream_state: Mapping[str, Any] = None) -> Iterable[Mapping[str, Any]]: lists_stream = Lists(**kwargs) for list_record in lists_stream.read_records(sync_mode=SyncMode.full_refresh): list_id = list_record["id"] yield from super().read_records(sync_mode=SyncMode.full_refresh, stream_slice={"list_id": list_id}) def path(self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None) -> str: list_id = stream_slice["list_id"] return f"lists/{list_id}/members" This example assumes that you have a working Lists class and an appropriate base class for ListMembers. Make sure to adjust the code according to your specific implementation and requirements.Aazam Thakur
06/15/2023, 11:01 PM{
"type": "TRACE",
"trace": {
"type": "ERROR",
"emitted_at": 1686869028212.925,
"error": {
"message": "Something went wrong in the connector. See the logs for more details.",
"internal_message": "name 'kwargs' is not defined",
"stack_trace": "Traceback (most recent call last):\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/main.py\", line 13, in <module>\n launch(source, sys.argv[1:])\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 156, in launch\n for message in source_entrypoint.run(parsed_args):\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 98, in run\n yield from map(AirbyteEntrypoint.airbyte_message_to_string, self.read(source_spec, config, config_catalog, state))\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 132, in read\n yield from self.source.read(self.logger, config, catalog, state)\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 139, in read\n raise e\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 120, in read\n yield from self._read_stream(\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 194, in _read_stream\n for record in record_iterator:\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 324, in _read_full_refresh\n for record_data_or_message in record_data_or_messages:\n File \"/workspaces/airbyte/airbyte-integrations/connectors/source-mailchimp/source_mailchimp/streams.py\", line 145, in read_records\n lists_stream = Lists(**kwargs)\nNameError: name 'kwargs' is not defined\n",
"failure_type": "system_error"
}
}
}kapa.ai
06/15/2023, 11:01 PMkapa.ai
06/15/2023, 11:02 PMAazam Thakur
06/15/2023, 11:07 PMlists_stream = Lists(**kwargs)\nNameError: name 'kwargs' is not defined"}}kapa.ai
06/15/2023, 11:07 PMkapa.ai
06/15/2023, 11:07 PMAazam Thakur
06/15/2023, 11:14 PMlists_stream = Lists(**kwargs)\nNameError: name 'kwargs' is not defined"}}kapa.ai
06/15/2023, 11:14 PMkapa.ai
06/15/2023, 11:14 PMAazam Thakur
06/16/2023, 12:10 AMlists_stream = Lists(**kwargs)\nNameError: name 'kwargs' is not defined"}}kapa.ai
06/16/2023, 12:10 AMkapa.ai
06/16/2023, 12:10 AMAazam Thakur
06/16/2023, 3:55 PMkapa.ai
06/16/2023, 3:55 PMkapa.ai
06/16/2023, 3:55 PM