13 lines
487 B
Python
13 lines
487 B
Python
|
|
from forgeclient import request
|
||
|
|
|
||
|
|
from handlers.repos import _repo_summary
|
||
|
|
|
||
|
|
|
||
|
|
def search_repos(query, limit=10):
|
||
|
|
"""Search public projects across Algo Forge (the Explore section)."""
|
||
|
|
limit = max(1, min(limit, 50))
|
||
|
|
data = request("GET", "/repos/search", params={"q": query, "limit": limit})
|
||
|
|
if isinstance(data, dict) and "error" in data:
|
||
|
|
return data
|
||
|
|
results = data.get("data", []) if isinstance(data, dict) else []
|
||
|
|
return [_repo_summary(r) for r in results]
|