This is my FastAPI Code:
@app.get("/")
async def read_index(
zones: Optional[List[str]] = None
):
print("zones:", zones)
for house in load:
if zones and house["location"] in zones:
continue
I am trying to filter a list of houses in "load". My problem is that I need to filter multiple str of zones, and it needs to accept either none, a string or a list.
I have been trying to debug for a while, by instering into the url ?zones=London or London, Cambridge, to see it was a problem with the list.
Until I tried to put the print statement and tested it with either list or string, which returned.
zonas: None
Which means that the url is not even accepting the query? So I am not sure how to even pass this parameter as a list?