classCurseForge#
- class CurseForge( )#
CurseForge. Requires an API key from console.curseforge.com.
- Parameters:
- api_key#
The API key.
- base_url#
The API’s base URL.
- Raises:
PlatformError – The API key is empty.
- search(
- query: str,
- *,
- project_type: Literal['mod', 'modpack', 'resourcepack', 'shader'] = 'modpack',
- game_version: str | None = None,
- loader: str | None = None,
- sort: Literal['relevance', 'downloads', 'popularity', 'newest', 'updated'] = 'relevance',
- offset: int = 0,
- limit: int = 20,
Search CurseForge’s catalogue.
CurseForge has no relevance order, so
relevancelists the most popular matches first. It serves 50 results a page and no more than 10,000 in all; larger limits read several pages, up to that depth.- Parameters:
query (str) – The search text.
project_type (Literal['mod', 'modpack', 'resourcepack', 'shader']) – The kind of project to find.
game_version (str | None) – Only match this Minecraft version.
loader (str | None) – Only match this mod loader.
sort (Literal['relevance', 'downloads', 'popularity', 'newest', 'updated']) – How to order the results.
offset (int) – How many results to skip.
limit (int) – The maximum number of results to return.
- Returns:
The results.
- Raises:
NetworkError – CurseForge could not be reached.
- Return type:
- authors(
- project: Project,
Return every author CurseForge lists for a project, in its order.
- Parameters:
project (Project) – The project.
- Returns:
Their names.
- Raises:
NetworkError – CurseForge could not be reached or does not know it.
- Return type:
- changelog(
- release: Release,
Return what changed in a release, converted from CurseForge’s HTML.
- Parameters:
release (Release) – The release.
- Returns:
The changelog as plain text, with list items as
-lines, or an empty string if there is none.- Raises:
NetworkError – CurseForge could not be reached or does not know it.
- Return type:
- get_projects( ) dict[str, Project]#
Look up several projects by id, in as few requests as possible.
- Parameters:
- Returns:
Each project CurseForge knows, keyed by id. Unknown ids and slugs are left out.
- Raises:
NetworkError – CurseForge could not be reached.
- Return type:
- get_project( ) Project#
Look up a project by id, slug or URL.
- Parameters:
- Returns:
The project. Its type is the one CurseForge reports, when known.
- Raises:
PlatformError – No project has that slug.
NetworkError – CurseForge could not be reached or does not know the id.
- Return type:
- iter_releases(
- project: Project,
- *,
- game_version: str | None = None,
- loader: str | None = None,
- release_only: bool = False,
Yield a project’s releases, newest first, reading pages as needed.
Server packs are left out. CurseForge serves at most 10,000 files per project, so older releases of a larger project are not listed.
- Parameters:
- Yields:
Each release, once.
- Raises:
NetworkError – CurseForge could not be reached.
- get_release(
- release_id: str,
Look up a release by id.
- Parameters:
release_id (str) – The file’s id.
- Returns:
The release.
- Raises:
PlatformError – CurseForge does not know the id.
NetworkError – CurseForge could not be reached.
- Return type:
- identify(
- paths: Iterable[Path | str],
- *,
- progress: Callable[[Progress], None] | None = None,
- cancel: CancelToken | None = None,
Find the releases that files came from, by their fingerprints.
- Parameters:
- Returns:
The release of each file CurseForge knows. Other files are left out.
- Raises:
OSError – A file could not be read.
NetworkError – CurseForge could not be reached.
Cancelled –
cancelwas triggered.
- Return type:
- resolve(
- pack: Modpack,
Look up download details for a CurseForge pack.
A file whose author disallows third-party downloads stays unresolved and carries a
manual_url. A file CurseForge no longer lists also stays unresolved, with nomanual_url.- Parameters:
pack (Modpack) – The modpack.
- Returns:
The modpack with resolved entries.
- Raises:
NetworkError – CurseForge could not be reached.
- Return type: