File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ async def get(
9595 # If the length of the results list is 1, this is likely the results of a single
9696 # HTTP request. So returning just that one result, not a list containing one item.
9797 # If the length is > 1, return the list containing the httpx.Responses.
98+ # TODO: Return all results as a list. Will need to refactor all manufacturer
99+ # routers.
98100 if len (results ) == 1 :
99101 return results [0 ]
100102 else :
Original file line number Diff line number Diff line change @@ -160,6 +160,13 @@ async def main(
160160
161161 remainder = await http .get (uri = urls_to_fetch )
162162
163+ # If we only have the initial API call and one additional API call, the response
164+ # back from the http helper library is a httpx.Response object. If we have multiple
165+ # additional API calls, the response back is a list. Catching this situation and
166+ # throwing that single httpx.Response object into a list for further processing.
167+ if type (remainder ) != list :
168+ remainder = [remainder ]
169+
163170 # Loop through the inventory results list
164171 for api_result in remainder :
165172 result = api_result .json ()
You can’t perform that action at this time.
0 commit comments