(self, query: str)
return suggestions
Returns a list of suggested items for the given query.
Returns a list of suggested items for the given query.
Returns a list of suggested items for the given query .
def get_search_suggestions(self, query: str) -> List[str]:
        """Returns a list of suggested items for the given query."""

        if len(query.strip()) <= 1:
            # query length needs to be at least two characters
            return []

        result = self.web_client.get(
            "autocomplete", params={"prefix": query, "limit": "20"}
        )

        try:
            suggestions = result["results"]["tracks"]
        except (KeyError, TypeError):
            return []

        suggestions = [
            suggestion
            for suggestion in suggestions
            if suggestion != query and not song_utils.is_forbidden(suggestion)
        ]
        return suggestions
def get_search_suggestions ( self , query : str ) -> List [ str ] : if len ( query . strip ( ) ) <= 1 : # query length needs to be at least two characters return [ ] result = self . web_client . get ( "autocomplete" , params = { "prefix" : query , "limit" : "20" } ) try : suggestions = result [ "results" ] [ "tracks" ] except ( KeyError , TypeError ) : return [ ] suggestions = [ suggestion for suggestion in suggestions if suggestion != query and not song_utils . is_forbidden ( suggestion ) ] return suggestions