Slackbot
10/24/2023, 1:59 PMkapa.ai
10/24/2023, 2:00 PM__init__ method in your Result class seems to be correctly implemented. You're initializing the parent stream (task_id) using super().__init__(parent_stream = task_id). As for the next_page_token method, it's used for handling pagination in APIs. If the API you're working with doesn't support pagination, you can return None as you're currently doing. If it does support pagination, you would need to extract the next page "token" from the latest response. This "token" can be an ID, a page number, a partial URL, etc. The CDK will continue making requests as long as the next_page_token continues returning non-None results. This can then be used in the request_params and other methods in HttpStream to page through API responses. Here's an example of how it's done in the Stripe API: python def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: data = response.json().get(self.data_field) if data and len(data) == self.limit: return {self.cursor_field: data[-1][self.cursor_field]} return None In this example, the next_page_token method checks if the length of the data is equal to the limit of records per page. If it is, it means there's another page, so it returns the ID of the last object in the data as the next page token. If not, it returns None, indicating there are no more pages. You can refer to the [Airbyte documentation](https://docs.airbyte.com/connector-development/cdk-python/http-streams) for more details on handling pagination with the next_page_token method. Please note that the actual implementation of these methods can vary depending on the specifics of the API you're working with.Karsten Bruns
10/24/2023, 2:04 PMkapa.ai
10/24/2023, 2:05 PMHttpSubStream and encountering an error because the parent argument is missing. In the Python CDK, when you're dealing with nested streams (substreams), you need to pass the parent stream as an argument when initializing the substream. This is because the substream needs to know which parent stream it belongs to. Here's an example from the extracts: python class UserNumbers(HttpSubStream, AircallStream): parent: object = Users primary_key = "" In this example, Users is the parent stream for the UserNumbers substream. So, in your case, you should pass the parent stream when initializing your substream. If task_id is your substream, you should have a parent stream defined for it. If you're still having trouble, I recommend checking out the [Airbyte documentation](https://docs.airbyte.com/connector-development/connector-builder-ui/partitioning/) and [tutorials](https://docs.airbyte.com/connector-development/tutorials/cdk-speedrun) for more information on how to work with substreams.Karsten Bruns
10/24/2023, 2:08 PMkapa.ai
10/24/2023, 2:08 PMkapa.ai
10/24/2023, 2:08 PMKarsten Bruns
10/24/2023, 2:12 PMparent: object = Task_id
url_base = Task_id.url_base
primary_key = None
def __init__(self, task_id: HttpStream):
super().__init__(parent_stream = task_id)kapa.ai
10/24/2023, 2:12 PMkapa.ai
10/24/2023, 2:12 PMKarsten Bruns
10/24/2023, 2:19 PMparent: object = Task_id
url_base = Task_id.url_base
primary_key = None
def __init__(self, task_id: HttpStream):
super().__init__(parent_stream = task_id)kapa.ai
10/24/2023, 2:19 PMkapa.ai
10/24/2023, 2:19 PMKarsten Bruns
10/24/2023, 2:30 PMparent: object = Task_id
url_base = Task_id.url_base
primary_key = None
def __init__(self, task_id: HttpStream):
super().__init__(parent_stream = task_id)kapa.ai
10/24/2023, 2:30 PMkapa.ai
10/24/2023, 2:30 PM