Ofek Eliahu
07/21/2025, 11:40 AMkapa.ai
07/21/2025, 11:40 AMSource class, not directly within the HttpStream class. The check_connection method is part of the Source class, and its purpose is to validate the configuration and connectivity before running a sync. The typical pattern is for the check_connection method in your Source class to instantiate one or more streams (which may be subclasses of HttpStream), attempt to read a record, and return success or failure based on the result. Here is an example from the documentation: python def check_connection(self, logger, config) -> Tuple[bool, any]: first_stream = next(iter(self.streams(config))) stream_slice = next(iter(first_stream.stream_slices(sync_mode=SyncMode.full_refresh))) try: read_stream = first_stream.read_records(sync_mode=SyncMode.full_refresh, stream_slice=stream_slice) first_record = None while not first_record: first_record = next(read_stream) if isinstance(first_record, AirbyteMessage): if first_record.type == "RECORD": first_record = first_record.record return True, None else: first_record = None return True, None except Exception as e: return False, f"Unable to connect to the API with the provided credentials - {str(e)}" This approach leverages the `HttpStream`'s logic but keeps the check operation in the Source class, as intended by the Airbyte CDK design. There is no documented or recommended way to perform the check operation directly inside the HttpStream class itself. The HttpStream is designed for data fetching, not for configuration or connection validation logic [Check and error handling](https://docs.airbyte.com/platform/connector-development/tutorials/custom-python-connector/check-and-error-handling). Summary: No, it is not standard or supported to implement the check validation inside the HttpStream class. The check should be performed in the Source class using the check_connection method, which can utilize the streams for validation.Ofek Eliahu
07/21/2025, 11:43 AMkapa.ai
07/21/2025, 11:43 AMkapa.ai
07/21/2025, 11:44 AMparse_response method and raise a user-friendly error, or simply yield no records if the stream is unavailable. Here’s how you can do it: 1. Disable the availability strategy in your stream by returning `None`: python from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy @property def availability_strategy(self) -> Optional[AvailabilityStrategy]: return None 2. Handle the error in your stream (for example, in parse_response): python def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: response_json = response.json() if response_json.get("error") == "stream_not_available": # Optionally log or handle the missing stream gracefully return # Yields nothing, so the stream is skipped # Normal parsing logic yield from response_json.get("data", []) 3. In your Source's check_connection, you can also handle the case where a stream is missing by catching exceptions and not failing the check if the stream is optional. This approach ensures that if the stream is not available, it will not throw an error and will simply be skipped, which matches your requirements [Check and error handling](https://docs.airbyte.com/platform/connector-development/tutorials/custom-python-connector/check-and-error-handling). Summary: - Disable the availability strategy. - Handle missing/optional stream errors gracefully in your stream’s code (e.g., in parse_response). - Optionally, handle this in your check_connection logic if needed. This is the recommended way to handle optional streams in Airbyte connectors.