classCurseForge#

class CurseForge(
api_key: str,
*,
session: Session | None = None,
base_url: str = 'https://api.curseforge.com',
)#

CurseForge. Requires an API key from console.curseforge.com.

Parameters:
  • api_key (str) – The API key.

  • session (Session | None) – The session to use. If omitted, the platform creates its own.

  • base_url (str) – The API’s base URL.

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,
offset: int = 0,
limit: int = 20,
) → SearchResults#

Search CurseForge’s catalogue.

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.

  • offset (int) – How many results to skip.

  • limit (int) – The maximum number of results to return.

Returns:

One page of results.

Raises:

NetworkError – CurseForge could not be reached.

Return type:

SearchResults

get_project(
ref: str | int,
*,
project_type: Literal['mod', 'modpack', 'resourcepack', 'shader'] = 'modpack',
) → Project#

Look up a project by id, slug or URL.

Parameters:
  • ref (str | int) – The project’s id, slug or web address.

  • project_type (Literal['mod', 'modpack', 'resourcepack', 'shader']) – The kind of project. Slugs are only unique within a type.

Returns:

The project.

Raises:
Return type:

Project

iter_releases(
project: Project,
*,
game_version: str | None = None,
loader: str | None = None,
release_only: bool = False,
) → Iterator[Release]#

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:
  • project (Project) – The project.

  • game_version (str | None) – Only list this Minecraft version.

  • loader (str | None) – Only list this mod loader.

  • release_only (bool) – Leave out alpha and beta releases.

Yields:

Each release, once.

Raises:

NetworkError – CurseForge could not be reached.

resolve(
pack: Modpack,
) → 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 no manual_url.

Parameters:

pack (Modpack) – The modpack.

Returns:

The modpack with resolved entries.

Raises:

NetworkError – CurseForge could not be reached.

Return type:

Modpack