I use the low-code development in airbyte but i wa...
# ask-ai
m
I use the low-code development in airbyte but i want to use multiple input for a specific variavle and get the result for all inputs instead of just one input. for example I have this api http://127.0.0.1:8000/{{city_name}} and I have 100 city name that i want to execute that restful api for 100 city_name instead of just input
k
To achieve this, you can modify your
request_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:
Copy code
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)