Skip to main content

CurseForgeAPy

GitHub issues GitHub stars GitHub license

CurseForgeAPy is a Python package that provides a wrapper for the CurseForge API / Eternal API. With CurseForgeAPy, you can easily access and interact with the API in your Python scripts and applications. Currently, the entire API has been wrapped and each data structure has been reconstructed into seperate classes, which can be found within SchemaClasses.py.

Installation

To install CurseForgeAPy, simply use pip:

pip install CurseForgeAPy

Usage

To use CurseForgeAPy, you will need to obtain an API key from CurseForge. You can do this by creating an account on CurseForge and requesting an API key from the developer portal.

Once you have obtained an API key, you can use CurseForgeAPy as follows:

from CurseForgeAPy import CurseForgeAPI

# Instantiate the CurseForgeAPy client
client = CurseForgeAPI('YOUR_API_KEY')

# Use the client to make API requests
response = client.getGames() # -> returns a GetGamesResponse

print(response)

Documentation

For full documentation of the CurseForge API, please see the official CurseForge API documentation at https://docs.curseforge.com/. Docstrings are also available for some functions, however complete docstring creation for all functions is ongoing.

Examples

Here are some examples of how you can use CurseForgeAPy to access and interact with the CurseForge API:

Games

# get all games
games = cf.getGames()

# get specific game
game = cf.getGame(432)

# get version of specific game
versions = cf.getVersions(432)

# get version type of specific game
versionTypes = cf.getVersionTypes(432)

# get all mod categories of specific game
categories = cf.getCategories(432)

Mods

import CurseForgeAPy.SchemaClasses as schemas

# search for mods within specific game
searchResults = cf.searchMods(432)

# get specific mod
mod = cf.getMod(729219)

# get an array of mods from ids
mods = cf.getMods([729219])

# initialise GetFeaturedModsRequestBody object for use in get_featured_mods
featuredModsSearch = schemas.GetFeaturedModsRequestBody(432, [], 73242)

# get featured mods within specific game
featuredMods = cf.GetFeaturedMods(featuredModsSearch)

# get string description of specific mod
modDescription = cf.getModDescription(729219)

# get specific file within specific mod
modFile = cf.getModFile(729219, 4159320)

# get files based off of FileId
modFiles = cf.getModFiles(729219)

Files

# get files from list of ids
files = cf.getFiles(schemas.GetModFilesRequestBody([4159320]))

# get changelog of a specified mod and file id
changelog = cf.getModFileChangelog(729219, 4159320)

# get download url for a mod file
modFileDownloadUrl = cf.getModFIleDownloadUrl(729219, 4159320)

Fingerprints

# get exact matches for a fingerprint
fingerprintsMatches = cf.getFingerprintsMatches(schemas.GetFingerprintMatchesRequestBody([2352728825]))

# get fuzzy matches for a partial fingerprint
fuzzyMatches = cf.getFingerprintsFuzzyMatches(schemas.GetFuzzyMatchesRequestBody(432, [schemas.FolderFingerprint("test", [2352728825])]))

Minecraft

# get minecraft versions
minecraftVersions = cf.getMinecraftVersions()

# get a specific minecraft version
minecraftVersion = cf.getSpecificMinecraftVersion("1.16.5")

# get a list of minecraft modloaders
minecraftModloaders = cf.getMinecraftModloaders()

# get a specific minecraft modloader
minecraftModloader = cf.getSpecificMinecraftModloader("forge-1.16.5-36.1.0")

Utilities

# Within the CurseForgeAPy package, there is a utility class that has a couple helper functions, mainly downloading files related.
# These functions shouldnt be called without a CurseForgeAPy client object, as they use the client to get the download url.

from CurseForgeAPy import Utils
from CurseForgeAPy import SchemaClasses as schemas

# Each function take in a CurseForgeAPy client object, and a specific parameter, finishing with a file path to save the file to.
cf = CFAPI('YOUR-API-KEY')

# Download a file from a url
Utils.downloadFileFromURL(cf, "file-url", "file-path")

# Download a specified file from id
Utils.downloadFileFromID(cf, 111111, "file-path")

# Download a specified file from a mod id
Utils.downloadFileFromModID(cf, 111111, "file-path")

# Download a specified file from a mod id and file id
Utils.downloadFileFromModIDAndFileID(cf, 111111, 222222, "file-path")

# Download a specified file from a mod id and version, with optional release type (defaults to None which is any release type)
# Can return an exception if the version is not found
Utils.downloadFileFromModIDVersion(cf, 111111, "1.16.5", "file-path", schemas.ReleaseType.Release)

Support

If you have any issues or questions while using CurseForgeAPy, please feel free to open an issue on the GitHub repository or contact us through our support channels.

Contribution

We welcome contributions to CurseForgeAPy! Please feel free to open a pull requests or issue if you would like a new feature.

Metadata

Release files for CurseForgeAPy 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CurseForgeAPy 1.1.5
File Size Uploaded
CurseForgeAPy-1.1.5.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for CurseForgeAPy 1.1.5
File Interpreter ABI Platform
CurseForgeAPy-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 32.3 kB

Release files / CurseForgeAPy-1.1.5.tar.gz

Download URL CurseForgeAPy-1.1.5.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
75d949129fc535594aee445cf99b608804a3051b13a211f8f4a97b8f536bdc60
BLAKE2b-256 checksum
How to use checksums
2533a5dd2a109c38802a32921e76398927bd0480204d0ea646162c6281471b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / CurseForgeAPy-1.1.5-py3-none-any.whl

Download URL CurseForgeAPy-1.1.5-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8bb1c84a83ce566cbd90e132fbc680292491c0d88f0755cb5fc0a901f9421dc
BLAKE2b-256 checksum
How to use checksums
491b2234451d60f2ba3a41bd1f5aa96b64c7577d27acb2be2fef7b40f122f1ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page