Mahsa Faraji
07/18/2024, 12:03 PMkapa.ai
07/18/2024, 12:04 PMrequest_params
to return a list of dictionaries where each entry corresponds to the same request but for a different city. However, returning a list of dictionaries instead of one dictionary in the request_params
might result in a Too many values to unpack
error. A recommended approach is to use stream_slices
by creating a slice per city you want to consume. You will also need to change your spec.json
to accept an array
of cities instead of a string
. Here is an example of how you might modify your parse_response
method: python def parse_response( self, response: requests.Response, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None, ) -> Iterable[Mapping]: response = response.json() restructured_response = Transform.restructure_response(response, "historical") return [restructured_response]
Please note that this is just an example and you might need to adjust it according to your specific use case. You can find more information about stream slices in the [Airbyte documentation](https://docs.airbyte.com/connector-development/cdk-python/stream-slices/). If you need further assistance, consider sharing a sample of your current code on the [Airbyte community forum](https://discuss.airbyte.io/t/586) for more specific guidance. Sources: - [Forum Post: Using an array instead of a string in the config](https://discuss.airbyte.io/t/586) - [Airbyte Documentation: Low-code connector development](https://docs.airbyte.com/connector-development/config-based/low-code-cdk-overview)