MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / search_projects

Method search_projects

scratchattach/site/session.py:623–648  ·  view source on GitHub ↗

Uses the Scratch search to search projects. Keyword arguments: query (str): The query that will be searched. mode (str): Has to be one of these values: "trending", "popular" or "recent". Defaults to "trending". language (str): A language abbrevia

(
        self, *, query: str = "", mode: str = "trending", language: str = "en", limit: int = 40, offset: int = 0
    )

Source from the content-addressed store, hash-verified

621 # --- Search ---
622
623 def search_projects(
624 self, *, query: str = "", mode: str = "trending", language: str = "en", limit: int = 40, offset: int = 0
625 ) -> list[project.Project]:
626 """
627 Uses the Scratch search to search projects.
628
629 Keyword arguments:
630 query (str): The query that will be searched.
631 mode (str): Has to be one of these values: "trending", "popular" or "recent". Defaults to "trending".
632 language (str): A language abbreviation, defaults to "en".
633 (Depending on the language used on the Scratch website, Scratch displays you different results.)
634 limit (int): Max. amount of returned projects.
635 offset (int): Offset of the first returned project.
636
637 Returns:
638 list<scratchattach.project.Project>: List that contains the search results.
639 """
640 query = f"&q={query}" if query else ""
641
642 response = commons.api_iterative(
643 f"https://api.scratch.mit.edu/search/projects",
644 limit=limit,
645 offset=offset,
646 add_params=f"&language={language}&mode={mode}{query}",
647 )
648 return commons.parse_object_list(response, project.Project, self)
649
650 def explore_projects(
651 self, *, query: str = "*", mode: str = "trending", language: str = "en", limit: int = 40, offset: int = 0

Callers 2

test_projectFunction · 0.80
test_searchFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_projectFunction · 0.64
test_searchFunction · 0.64